title: How to create a summary table (means) of the inputs from a shiny app?
body: <p>I have a Shiny app that collects Heights and Weights using the interface from the shiny app.</p>
  <p>What I would like to have, is a table just below the raw value table that gives me an average of the heights and weights that were inputed into the app, and changes as rows are entered or deleted.</p>
  <p>I tried to add some code to the replaceData function but that throws an error.</p>
  <pre><code>library(shiny)
  library(tidyverse)
  library(DT)
  
  df &lt;- dplyr::tibble(Height = numeric(), Weight = numeric())
  
  ui &lt;- fluidPage(
    
    # App title ----
    titlePanel(&quot;DT + Proxy + Replace Data&quot;),
    
    # Sidebar layout with input and output definitions ----
    sidebarLayout(
      
      # Sidebar panel for inputs ----
      sidebarPanel(
        
        # Input: Slider for the number of bins ----
        shiny::textInput(inputId = &quot;height&quot;, label = &quot;height&quot;),
        shiny::textInput(inputId = &quot;weight&quot;, label = &quot;weight&quot;),
        
        shiny::actionButton(inputId = &quot;add&quot;, label = &quot;Add&quot;),
        
        shiny::selectInput(inputId = &quot;remove_row&quot;, label = &quot;Remove Row&quot;,
                           choices = 1:nrow(df)),
        
        shiny::actionButton(inputId = &quot;remove&quot;, label = &quot;Remove&quot;)
        
      ),
      
      # Main panel for displaying outputs ----
      mainPanel(
        
        # Output: Histogram ----
        DT::DTOutput(outputId = &quot;table&quot;),
        DT::DTOutput(outputId = &quot;mean_table&quot;),
        
        
      )
    )
  )
  
  # Define server logic required to draw a histogram ----
  server &lt;- function(input, output, session) {
    
    mod_df &lt;- shiny::reactiveValues(x = df)
    
    output$table &lt;- DT::renderDT({
      
     mod_df$x
      
    })
    
  #table 2
    output$mean_table &lt;- DT::renderDT({
      
      mod_df$x
      
    })
    
    
    shiny::observe({
      shiny::updateSelectInput(session, inputId = &quot;remove_row&quot;,
                               choices = 1:nrow(mod_df$x))
    })
    
    shiny::observeEvent(input$add, {
      
      mod_df$x &lt;- mod_df$x %&gt;%
        dplyr::bind_rows(
          dplyr::tibble(Height = as.numeric(input$height),
                        Weight = as.numeric(input$weight))) 
      
      
    })
    
    shiny::observeEvent(input$remove, {
      
      mod_df$x &lt;- mod_df$x[-as.integer(input$remove_row), ]
      
    })
    
    proxy &lt;- DT::dataTableProxy('table')
  
    
    shiny::observe({
      
      DT::replaceData(proxy, mod_df$x) 
    
    
    })
    
    
  }
  
  shinyApp(ui, server) 
  
  </code></pre>