How do you calculate data taken from textInput boxes in Shiny?
<p>ui code:</p>

<p>===</p>

<pre><code>library(shiny)

  shinyUI(

    # Use a fluid Bootstrap layout
    fluidPage(    


      # Generate a row with a sidebar
      sidebarLayout(      


        # Define the sidebar with one input
        sidebarPanel(
          sliderInput("capacity", "Current Capacity:", 
                      min=0, max=100, value=10),
          c(list(
            textInput("service", "Service Component Name", ""),
            actionButton("addbtn", "Add Component"))),
            #lapply(seq(10), function(i) uiOutput(paste0("ui", i)))

            br(),
            br(), 
            br(),
            br(),
            br(),
          actionButton("calcbtn", "Calculate Projection")




        ),



        # Create a spot for the barplot
        mainPanel(
          textInput("inputWork","Volume", width="200px"),
          textInput("inputGrowth","Growth Rate", width="100px"),
          lapply(seq(10), function(i) uiOutput(paste0("ui", i)))
          #tags$p("Web"),
          #verbatimTextOutput("input_type_text")

        )

      )
    )
  )
</code></pre>

<h1>server code:</h1>

<pre><code>   server &lt;- function(input, output) 
{
  observeEvent(input$addbtn, {
    n &lt;- isolate(input$addbtn)
    if (n == 0) return()

    # create n-th pair of text input and output
    output[[paste0("ui", n)]] &lt;- renderUI(
      list(textInput(paste0("textin", n), isolate(input$service)),
           textOutput(paste0("textout", n))))

    # display something in the output
    output[[paste0("textout", n)]] &lt;- renderText({
      work&lt;-as.numeric(input$inputWork)
      growth&lt;-as.numeric(input$inputGrowth)
      print(growth)


     #paste("projection", (100+growth)*as.numeric(input[[paste0("textin", n)]]))
    })
  })
  observeEvent(input$calcbtn, {
    n &lt;- isolate(input$calcbtn)
    if (n == 0) return()

    output[[paste0("textout", n)]] &lt;- renderText({
      work&lt;-as.numeric(input$inputWork)
      growth&lt;-as.numeric(input$inputGrowth)
      project&lt;-growth+as.numeric(input$service)

      print(growth)
      print(project)

      paste("projection", ((1+growth/100)*as.numeric(input[[paste0("textin", n)]])))
    })
  })
}
</code></pre>

<p>This is what I am trying to do. This code will have an initial text box and submit button. User put a text in the first input text, clicks the submitbutton, a new text generated in the main panel. A user can do this multiple times to create multiple textInput boxes in the main panel.</p>

<p>I also have a static another inputText box labeled Workload on top of the main panel.</p>

<p>So, this is what I am trying to do:</p>

<ol>
<li>User will insert data in workload textIntut (it needs to numeric).</li>
<li>User will insert data into other dynamically generated textInput boxes (all need to be numeric).</li>
<li>I will get the values from workload and all the other textboxes, do some calculations and projections and display data next to each dynamically generated textInput boxes, it would be great if I could insert textboxes next to the ones generate to display my output.</li>
</ol>

<p>For example, I have data in my workload, I have generated Web_server, App_server textInput boxes. I will take the data from workload and devided that by the data in web_server, and display it next to the web_server textInput box (show the data in a textbox), do the same for the app_server textInput box.</p>

<p>Any ideas how I could do this in shiny? This is the image what I am trying to accomplish. Given the Workload Growth Rate taken from the user and other inputs from the User Input section, I will have to calculate and populate the respective textboxes. </p>