title: How to combine multiple inputs in one vector in shiny. Number of inputs depends on user's choice
body: <p>I'm trying to create an UI in which user can choose some objects (as many as they want) and their respective weights. The weight input fields appear only when there's more than one object and increase as the user selects more objects. This part already works.</p>
  
  <p>What I need is a vector that holds all the weights saved in the <code>w1</code>, <code>w2</code> and so on.</p>
  
  <p>I've tried using for loops and sapply with <code>get()</code> function but can't access the <code>input$w1</code>, <code>input$w2</code> etc.</p>
  
  <pre class="lang-r prettyprint-override"><code>library(shiny)
  
  # Create list of objects
  object_list &lt;- vector()
  object_list &lt;- paste0("O_", 1:10)
  names(object_list) &lt;- paste("Object", 1:10)
  
  ui &lt;- dashboardPage(
    dashboardHeader(title = "Dynamic UI"),
    dashboardSidebar(
      width = 700,
      fluidRow(
        column(7, selectInput("chosen_objects", "Chosen objects", choices = object_list, multiple = TRUE, width = "100%")),
        column(5, uiOutput("weights"))
      )
    ),
    dashboardBody(
      fluidPage(tabBox(width=2500,
                       tabPanel(
                         title = "Table"
                        )
      )
      )
    )
  )
  
  server &lt;- function(input,output) {
  
    objects_number &lt;- reactive({length(input$chosen_objects)})
  
    output$weights &lt;- renderUI({
      if (is.na(objects_number()) | objects_number() &lt;= 1)
        return(NULL)
      lapply(1:objects_number(), function(i) {
        id &lt;- paste0("w", i)
        textInput(id, paste("Weight of", input$chosen_objects[i]), value = input[[id]], width = "50%", placeholder = "%")
      })
    })
  
  }
  
  shinyApp(ui, server)
  </code></pre>
  
  <p>Is there a way to collect the dynamic inputs in one vector or list?</p>