Specify initial filter states and filtering settings for a teal app.
Usage
teal_slices(
...,
exclude_varnames = NULL,
include_varnames = NULL,
count_type = NULL,
allow_add = TRUE,
module_specific = FALSE,
mapping,
app_id = NULL
)
as.teal_slices(x)
# S3 method for class 'teal_slices'
c(...)Arguments
- ...
any number of
teal_sliceobjects.- include_varnames, exclude_varnames
(
named lists ofcharacter) where list names match names of data sets and vector elements match variable names in respective data sets; specify which variables are allowed to be filtered; seeDetails.- count_type
-
This is a new feature. Do kindly share your opinions on
teal.slice's GitHub repository.(
character(1)) string specifying how observations are tallied by these filter states. Possible options:"none"(default) to have counts of singleFilterStateto show unfiltered number only."all"to have counts of singleFilterStateto show number of observation in filtered and unfiltered dataset. Note, that issues were reported when using this option withMultiAssayExperiment. Please make sure that adding new filters doesn't fail on target platform before deploying for production.
- allow_add
(
logical(1)) logical flag specifying whether the user will be able to add new filters- module_specific
-
(
logical(1)) optional,FALSE(default) when one filter panel applied to all modules. All filters will be shared by all modules.TRUEwhen filter panel module-specific. Modules can have different set of filters specified - seemappingargument.
- mapping
-
This is a new feature. Do kindly share your opinions on
teal's GitHub repository.(named
list) specifies which filters will be active in which modules on app start. Elements should contain character vector ofteal_sliceids (seeteal.slice::teal_slice). Names of the list should correspond toteal_modulelabelset inmodule()function.ids listed under"global_filterswill be active in all modules.If missing, all filters will be applied to all modules.
If empty list, all filters will be available to all modules but will start inactive.
If
module_specificisFALSE, onlyglobal_filterswill be active on start.
- app_id
(
character(1)) For internal use only, do not set manually. Added byinitso that ateal_slicescan be matched to the app in which it was used. Used for verifying snapshots uploaded from file. Seesnapshot.- x
(
list) of lists to convert toteal_slices
Details
Produces a teal_slices object.
The teal_slice components will specify filter states that will be active when the app starts.
Attributes (created with the named arguments) will configure the way the app applies filters.
See argument descriptions for details.
Examples
filter <- teal_slices(
teal_slice(dataname = "iris", varname = "Species", id = "species"),
teal_slice(dataname = "iris", varname = "Sepal.Length", id = "sepal_length"),
teal_slice(
dataname = "iris", id = "long_petals", title = "Long petals", expr = "Petal.Length > 5"
),
teal_slice(dataname = "mtcars", varname = "mpg", id = "mtcars_mpg"),
mapping = list(
module1 = c("species", "sepal_length"),
module2 = c("mtcars_mpg"),
global_filters = "long_petals"
)
)
app <- init(
data = teal_data(iris = iris, mtcars = mtcars),
modules = list(
module("module1"),
module("module2")
),
filter = filter
)
if (interactive()) {
shinyApp(app$ui, app$server)
}