I have a rHandsontable table (rhandsontable package) and now I am searching a way how to transfer data from the table into a dataframe.
So far I have not found a clear clue how to perfrom this action.
I would be very grateful for the plain and clear example or useful link.
Besides, I have scanned a useful link. It throws a glimpse of light concerning how to manipulate data inside rhandsontable object.
But no explanation about methods used have been found. It looks like a black box testing. It would be nice if you could share some knowledge of this matter (if any).
Look into the shinysky package, as it uses Handsontable, which has hot.to.df function that would allow you to convert your datatable into dataframe. Below is a minimal example showing what I mean
rm(list = ls())
library(shiny)
library(shinysky)
server <- shinyServer(function(input, output, session) {
# Initiate your table
previous <- reactive({head(mtcars)})
Trigger_orders <- reactive({
if(is.null(input$hotable1)){return(previous())}
else if(!identical(previous(),input$hotable1)){
# hot.to.df function will convert your updated table into the dataframe
as.data.frame(hot.to.df(input$hotable1))
}
})
output$hotable1 <- renderHotable({Trigger_orders()}, readOnly = F)
# You can see the changes you made
output$tbl = DT::renderDataTable(Trigger_orders())
})
ui <- basicPage(mainPanel(column(6,hotable("hotable1")),column(6,DT::dataTableOutput('tbl'))))
shinyApp(ui, server)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With