Server function corresponding to teal
srv_teal.Rd
It evaluates the raw_data
(delayed data mechanism) and creates the
datasets
object that is shared across modules.
Once it is ready and non-NULL
, the splash screen is replaced by the
main teal UI that depends on the data.
The currently active tab is tracked and the right filter panel
updates the displayed datasets to filter for according to the active datanames
of the tab.
Usage
srv_teal(id, modules, raw_data, filter = list())
Arguments
- id
(
character
)
module id to embed it, if provided, the server function must be called withshiny::moduleServer()
; See the vignette for an example. However,ui_teal_with_splash()
is then preferred to this function.- modules
(
list
,teal_modules
orteal_module
)
nested list ofteal_modules
orteal_module
objects or a singleteal_modules
orteal_module
object. These are the specific output modules which will be displayed in the teal application. Seemodules()
andmodule()
for more details.- raw_data
(
reactive
)
returns theTealData
, only evaluated once,NULL
value is ignored- filter
-
(
list
)
You can define filters that show when the app starts. List names should be named according to datanames passed to thedata
argument. In case of data.frame` the list should be composed as follows:list(<dataname1> = list(<varname1> = ..., <varname2> = ...), <dataname2> = list(...), ...)
For example, filters for variable
Sepal.Length
iniris
can be specified as follows:list(iris = list(Sepal.Length = list(selected = c(5.0, 7.0)))) # or list(iris = list(Sepal.Length = c(5.0, 7.0)))
In case developer would like to include
NA
andInf
values in the filtered dataset.list(Species = list(selected = c(5.0, 7.0), keep_na = TRUE, keep_inf = TRUE)) list(Species = c(c(5.0, 7.0), NA, Inf))
To initialize with specific variable filter with all values on start, one can use
list(Species = list())
filter
should be set with respect to the class of the column:numeric
:selected
should be a two elements vector defining the range of the filter.Date
:selected
should be a two elements vector defining the date-range of the filterPOSIXct
:selected
should be a two elements vector defining thedatetime
range of the filtercharacter
andfactor
:selected
should be a vector of any length defining initial values selected to filter.filter
forMultiAssayExperiment
objects should be specified in slightly different way. Since it contains patient data with list of experiments,filter
list should be created as follows:
list( <MAE dataname> = list( subjects = list(<column in colData> = ..., <column in colData> = ...), <experiment name> = list( subset = list(<column in rowData of experiment> = ..., <column in rowData of experiment> = ...), select = list(<column in colData of experiment> = ..., <column in colData of experiment> = ...) ) ) )
By adding the
filterable
attribute it is possible to control which variables can be filtered for each dataset. See the example below whereADSL
can only be filtered byAGE
,SEX
orRACE
.
Details
For more doc, see ui_teal()
.