I am trying to call R shiny module with reactive data from outside the module, I read the tutorial and knew that '()' should not be included in the callModule argument for reactive data. However I got an error message:
Warning: Error in as.vector: cannot coerce type 'closure' to vector of type
'list
after doing that.
Here is the code for the module:
pieTableUI <- function(id, header, titleInfo, width = 6) {
ns <- NS(id)
infoClick <- h3(header,
tipify(
el = icon("info-circle"), trigger = "hover click",
title = titleInfo
))
tagList(
tabBox(
tabPanel("Pie Chart",
infoClick,
htmlOutput(ns("piechart"))),
tabPanel("Table",
infoClick,
htmlOutput(ns("table"))),
width = width
)
)
}
pieTable <- function(input, output, session, dataChart, x, y) {
output$piechart <- renderGvis({
gvisPieChart_HCSC(dataChart, x, y)
})
output$table <- renderGvis({
gvisTable(dataChart)
})
}
And I called the module with:
callModule(pieTable, "agegroupplot", dataChart = agegroup_data, x = "AGE_GROUP_CLEAN", y = "n")
where agegroup_data
is a reactive dataframe from the server.