Hello,
I would like to use a reactive expression(function) from module aServer and use it in module bServer in modules.R.
modules.R
aServer <- function(id) {
moduleServer(
id,
function(input, output, session) {
userFile <- reactive({
expressions...
})
}
)
}
bServer <- function(id, *?*) { # What should I put as a parameter?
moduleServer(
id,
function(input, output, session) {
userFile() # I would like to do this, but How?
}
)
}
I've read the article "Communication between modules" on Shiny from RStudio(Shiny - Communication between modules), but I don't understand the logic behind the scatterplot_server_mod.
scatterplot_server_mod <- function(input, output, session, dataset, plot1vars, plot2vars) {
# Where do plot1vars and plot2vars come from?
# It's not defined anywhere in the app code.
plot1_obj <- reactive({
p <- scatter_sales(dataset, xvar = plot1vars$xvar(), yvar = plot1vars$yvar())
return(p)
})
# Shouldn't plot1vars be defined somewhere in order to subset xvar()?
# I assume xvar() is from varselect_mod_server,
# but I can't find plot1vars and plot2vars anywhere in app.R and modules.R.
plot2_obj <- reactive({
p <- scatter_sales(dataset, xvar = plot2vars$xvar(), yvar = plot2vars$yvar())
return(p)
})
Thank you for your help.