title: How to access secondary inputs with variable names in R Shiny?
body: <p>I'm trying to have the user enter a numeric input, then generate a number of input boxes equal to that first numeric input. I would then like to find the sum of the responses to these secondary numeric inputs. However, I am having trouble accessing these variables in a comprehensive way, since their names are created used numeric variables. Right now when I run it I get this error:
  <code>Warning: Error in get: object 'inp21' not found</code></p>
  <p>Thanks</p>
  <pre><code>library(shiny)
  
  ui &lt;- fluidPage(
      
      # Application title
      titlePanel(&quot;Test&quot;),
      
      sidebarLayout(
          sidebarPanel(
              numericInput(&quot;inp1&quot;,
                           &quot;Enter num:&quot;,1)
          ),
   
          mainPanel(
              uiOutput(&quot;more_inp&quot;),
              textOutput(&quot;num_inps&quot;)
          )
      )
  )
  
  
  server &lt;- function(input, output) {
      
      counter &lt;- reactiveValues(countervalue = 0)
      counter2 &lt;- reactiveValues(counter2value = 0)
      
      output$more_inp &lt;- renderUI({
          
          #Generates number of numeric inputs equal to original numeric input
          mylist &lt;- lapply(1:input$inp1, function(i) {
              
              inp_identifier &lt;- paste(&quot;inp2&quot;, i, sep=&quot;&quot;)
              inp_name&lt;- paste(&quot;Input2&quot;,i,sep=&quot; &quot;)
              
              
              list(
                  numericInput(inp_identifier,inp_name, 5)
              )
              
          })
          do.call(tagList, unlist(mylist, recursive = FALSE))
      })
      
      #Display number of secondary inputs
      
      #Count number of secondary inputs
      observeEvent(input$inp1, {
          counter$countervalue &lt;- counter$countervalue + 1     
      })
      
      #Find sum of secondary inputs
      output$num_inps&lt;-renderText(input$inp1)
      
              observeEvent(input$inp1,{
                  for (i in 1:counter$countervalue) {
                      counter2$counter2value &lt;- counter2$counter2value + get(paste(&quot;inp2&quot;, i, sep=&quot;&quot;))
                      print(counter2$counter2value)
                  }
              })
         
  }
  
  </code></pre>
  <h1>Run the application</h1>
  <pre><code>shinyApp(ui = ui, server = server)
  </code></pre>