add a row in a active value dataframe

Hi I'm new to the shiny package, I would like to save a data.frame as an active value and then add rows in several different outputs, taking into account the last modifications

library(shiny)

ui <- fluidPage(
DT::dataTableOutput("table"),
DT::dataTableOutput("table1"),
DT::dataTableOutput("table2")
)

server <- function(input, output) {

values <- reactiveValues(df = data.frame(x = c(1, 2, 3)))

output$table <- DT::renderDataTable({
values$df
})

output$table1 <- DT::renderDataTable({
y <- c(4, 5, 6)
values$df <- rbind(values$df, y)
values$df
})

output$table2 <- DT::renderDataTable({
y <- c(7, "a", 8)
values$df <- rbind(values$df, y)
values$df
})
}

shinyApp(ui, server)

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.