I am trying to create a shiny app, that would show a sum of a column (say mtcars$mpg) when rows are selected by the users. e.g if the first two boxes are clicked in rhandsontable, then below i should see a sum of 21 and 21. I am unable to wrap my head around it, and have made this code so far:
library(shiny)
library(rhandsontable)
ui=fluidPage(
rHandsontableOutput('table'),
textOutput ('selected')
)
server=function(input,output,session)({
df <- data.frame(head(transform(mtcars, Selected = as.logical(NA) )))
output$table=renderRHandsontable(
rhandsontable(df,selectCallback = TRUE,readOnly = FALSE)
)
output$selected<-renderText({
})
}) # end server
shinyApp(ui = ui, server = server)
is there any way to achieve this ?