Creates a teal_module object.
module.Rd
This function embeds a
shiny module inside a teal application. One teal_module maps to one shiny module.
Usage
module(
label = "module",
server = function(id, ...) {
moduleServer(id, function(input, output, session) {
})
},
ui = function(id, ...) {
tags$p(paste0("This module has no UI (id: ", id, " )"))
},
filters,
datanames = "all",
server_args = NULL,
ui_args = NULL
)
# S3 method for teal_module
toString(x, indent = 0, ...)
# S3 method for teal_module
print(x, ...)Arguments
- label
(
character(1)) Label shown in the navigation item for the module. Any label possible except"global_filters"- read more inmappingargument of teal_slices.- server
-
(
function)shinymodule with following arguments:id- teal will set proper shiny namespace for this module (seeshiny::moduleServer()).input,output,session- (not recommended) thenshiny::callModule()will be used to call a module.data(optional) module will receive atdataobject, a list of reactive (filtered) data specified in thefiltersargument.datasets(optional) module will receiveFilteredData. (See[teal.slice::FilteredData]).reporter(optional) module will receiveReporter. (See teal.reporter::Reporter)....(optional)server_argselements will be passed to the module named argument or to the....
- ui
-
(
function) Shinyuimodule function with following arguments:id- teal will set proper shiny namespace for this module.data(optional) module will receive list of reactive (filtered) data specified in thefiltersargument.datasets(optional) module will receiveFilteredData. (See[teal.slice::FilteredData])....(optional)ui_argselements will be passed to the module named argument or to the....
- filters
(
character) Deprecated. Usedatanamesinstead.- datanames
(
character) A vector withdatanamesthat are relevant for the item. The filter panel will automatically update the shown filters to include only filters in the listed datasets.NULLwill hide the filter panel, and the keyword'all'will show filters of all datasets.datanamesalso determines a subset of datasets which are appended to thedataargument inserverfunction.- server_args
(named
list) with additional arguments passed on to theserverfunction.- ui_args
(named
list) with additional arguments passed on to theuifunction.- x
teal_module- indent
(
integer) indent level; eachsubmoduleis indented one level more- ...
parameters passed to
toString
Examples
library(shiny)
app <- init(
data = teal_data(dataset("iris", iris)),
modules = list(
module(
label = "Module",
server = function(id, data) {
moduleServer(
id,
module = function(input, output, session) {
output$data <- renderDataTable(data[["iris"]]())
}
)
},
ui = function(id) {
ns <- NS(id)
tagList(dataTableOutput(ns("data")))
}
)
)
)
if (interactive()) {
runApp(app)
}