title: Shiny renderUI with multiple inputs
body: <p>My Shiny App has multiple inputs that depend on the number of variables used. A simplified version, though not working, is below. I was able to get the UI to update based upon the numericInput using a function called Make.UI which I used to make uiOutput, but getting the inputs back into the server is beyond my Shiny skill set! Any suggestions would be greatly appreciated.</p>
  
  <p>gwynn</p>
  
  <pre><code>library(shiny)
  D = matrix(runif(400), nrow = 20)
  colnames(D) = labs = sapply(1:20, function(i) {paste0("col",i)})
  
  # Define UI for application that summarises data
  ui &lt;- fluidPage(
  
    # Application title
    titlePanel("Summaries"),
  
    # Select columns to get fed into summary 
    tabsetPanel(
      tabPanel("Matching Variables Info",
               sidebarPanel(
  
                 numericInput("NoVars","No. of variables to summarize", 
                              value = 3, min = 2, max = dim(D)[2]),
  
                 uiOutput("VarsInput")
               ),
  
               # Show summaries of columns choosen above
               mainPanel(
                 verbatimTextOutput("dataInfo")
               )
      )
    )
  )
  
  
  # Define the server code
  server &lt;- function(input, output){
  
    Make.UI &lt;- function(NoV){
      C = sapply(1:NoV, function(i){paste0("cols",i)})
      L = sapply(1:NoV, function(i){paste0("label",i)})
  
      output = tagList()
  
      for(i in seq_along(1:NoV)){
        output[[i]] = tagList()
        output[[i]][[1]] = selectInput(C[i], "Variable to summarize:", labs)
        output[[i]][[2]] = textInput(L[i], label = "Label for variable:", 
                                     value = "Label for variable Here")
      } ## for loop
  
      output
    } # closes Make.UI function
  
    K &lt;- reactive({
      input$NoVars
    })
  
    output$VarsInput &lt;- renderUI({
      Make.UI(K())
    })
  
    output$dataInfo &lt;- renderPrint({
      C &lt;- sapply(1:K(), function(i) {input[[paste0("cols",i)]]})
      ## the code in the line above doesn't work
  
      summary(D[, C()])
    })
  
  }
  
  # Return a Shiny app object
  shinyApp(ui = ui, server = server)
  </code></pre>