title: R shiny datatable with numericinput and reactive column
body: <p>I am building a shiny datatable with one column for numericinput and the other reactive to the input. It is similar to what you can do in excel with equation embedded in cells. I am giving iris as example below and trying to calculate petal area. So peal area equals Petal.Length*Petal.Width/Adjust. The adjust parameter will be typed in by user to adjust area. A similar question was asked here but with no direct answer.
  <a href="https://stackoverflow.com/questions/22221089/insert-a-numeric-input-for-each-row-r-shiny?utm_medium=organic&amp;utm_source=google_rich_qa&amp;utm_campaign=google_rich_qa">Insert a numeric input for each row - R Shiny</a></p>
  
  <pre><code>library(shiny)
  library(DT)
  library(dplyr)
  
  ui &lt;- basicPage(
  
    DT::dataTableOutput('x1')
  )
  
  server &lt;- function(input, output, session) { 
    # create a character vector of shiny inputs 
    shinyInput = function(FUN, len, id, ...) { 
      inputs = character(len) 
      for (i in seq_len(len)) { 
        inputs[i] = as.character(FUN(paste0(id, i), label = NULL, ...))
      } 
      inputs 
    } 
  
    # obtain the values of inputs 
    shinyValue = function(id, len) { 
      unlist(lapply(seq_len(len), function(i) { 
        value = input[[paste0(id, i)]] 
        if (is.null(value)) 1 else value 
      })) 
    } 
  
    # a sample data frame 
    DF &lt;- reactive(
      iris &lt;- iris %&gt;%
        mutate(
          adjust = shinyInput(numericInput, nrow(iris), 'adj', value = 1),
          Petal_Area = Petal.Length*Petal.Width/shinyValue('adj', nrow(iris)) 
        )
    )
  
    # render the table containing shiny inputs 
    output$x1 = DT::renderDataTable(
  
      # use slider to control number of rows shown in table
      DF(), server = FALSE, escape = FALSE, options = list( 
        preDrawCallback = JS('function() { 
                             Shiny.unbindAll(this.api().table().node()); }'), 
        drawCallback = JS('function() { 
                          Shiny.bindAll(this.api().table().node()); } ') 
        ) 
        ) 
  } 
  
  shinyApp(ui, server)
  </code></pre>