I have an R dataframe that I am rendering in R ShinyTable. The editing in the ShinyTable works fine.
My question is: how do I take the edits the user has made and update my dataframe.
The code below was taken from a tutorial site for ShinyTable. It has an error: "Attempted to access deprecated shinysession$session object. Please just access the shinysession object directly." But there is nothing in the code that refers to shinySession.
If I can get help answering my primary question (how to take the edits the user has made) I can get around this error.
library(shiny)
library(shinyTable)
server <- function(input, output, session) {
rv <- reactiveValues(cachedTbl = NULL)
output$tbl <- renderHtable({
if (is.null(input$tbl)){
tbl <- matrix(0, nrow=3, ncol=3)
rv$cachedTbl <<- tbl
return(tbl)
} else{
rv$cachedTbl <<- input$tbl
return(input$tbl)
}
})
output$tblNonEdit <- renderTable({
input$actionButtonID
isolate({
rv$cachedTbl
})
})
}
ui <- shinyUI(pageWithSidebar(
headerPanel("shinyTable with actionButton to apply changes"),
sidebarPanel(
helpText(HTML("
Make changes to the upper table, press the button to activate.
<p>Created using <a href = \"http://github.com/trestletech/shinyTable\">shinyTable</a>."))),
mainPanel(
htable("tbl"),
actionButton("actionButtonID","apply edits"),
tableOutput("tblNonEdit")
)
))
shinyApp(ui = ui, server = server)