Hi Good Morning
I am working with Shiny app and a module. Module gets the data and does certain data cleansing and does certain plot. upto that it is fine. but I would like to get that processed data from the module to Shiny app. I am not able to get that. Could someone help me. given below minimum reproducible code (thanks - code taken from: Chapter 19 Shiny modules | Mastering Shiny)
library(shiny)
histogramUI <- function(id) {
ns <- NS(id)
tagList(
selectInput(ns("var"), "Variable", choices = names(mtcars)),
plotOutput(ns("hist"))
)
}
###############################################
histogramServer <- function(id) {
moduleServer(id, function(input, output, session) {
data <- reactive(mtcars[[input$var]])
output$hist <- renderPlot({
hist(data(), breaks = 20, main = input$var,col='lightblue')
})
})
return('mydata'=reactive(data()))
}
###############################################
ui <- fluidPage(
histogramUI("hist1")
)
server <- function(input, output, session) {
histogramServer("hist1")
}
shinyApp(ui, server)
###############################################