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 inmapping
argument of teal_slices.- server
-
(
function
)shiny
module 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 atdata
object, a list of reactive (filtered) data specified in thefilters
argument.datasets
(optional) module will receiveFilteredData
. (See[teal.slice::FilteredData]
).reporter
(optional) module will receiveReporter
. (See teal.reporter::Reporter)....
(optional)server_args
elements will be passed to the module named argument or to the...
.
- ui
-
(
function
) Shinyui
module 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 thefilters
argument.datasets
(optional) module will receiveFilteredData
. (See[teal.slice::FilteredData]
)....
(optional)ui_args
elements will be passed to the module named argument or to the...
.
- filters
(
character
) Deprecated. Usedatanames
instead.- datanames
(
character
) A vector withdatanames
that are relevant for the item. The filter panel will automatically update the shown filters to include only filters in the listed datasets.NULL
will hide the filter panel, and the keyword'all'
will show filters of all datasets.datanames
also determines a subset of datasets which are appended to thedata
argument inserver
function.- server_args
(named
list
) with additional arguments passed on to theserver
function.- ui_args
(named
list
) with additional arguments passed on to theui
function.- x
teal_module
- indent
(
integer
) indent level; eachsubmodule
is 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)
}