Filter settings for teal applications
teal_slices.Rd
Filter settings for teal applications
Usage
teal_slices(
...,
exclude_varnames = NULL,
include_varnames = NULL,
count_type = NULL,
allow_add = TRUE,
module_specific = FALSE,
mapping
)
as.teal_slices(x)
Arguments
- ...
any number of
teal_slice
objects. Forprint
andformat
, additional arguments passed to other functions.- include_varnames, exclude_varnames
(
named list
s 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.
(character(1)
) string specifying how observations are tallied by these filter states. Possible options:"none"
(default) to have counts of singleFilterState
to show unfiltered number only."all"
to have counts of singleFilterState
to 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)
)TRUE
when filter panel should be module-specific. All modules can have different set of filters specified - seemapping
argument.FALSE
when one filter panel needed to all modules. All filters will be shared by all modules.
- mapping
This is a new feature. Do kindly share your opinions.
(named list
)
Specifies which filters will be active in which modules on app start. Elements should contain character vector ofteal_slice
id
s (seeteal.slice::teal_slice()
). Names of the list should correspond toteal_module
label
set inmodule()
function.id
s listed under"global_filters
will 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. Ifmodule_specific
isFALSE
, onlyglobal_filters
will be active on start.- x
(
list
) of lists to convert toteal_slices
Examples
filter <- teal_slices(
teal.slice::teal_slice(dataname = "iris", varname = "Species", id = "species"),
teal.slice::teal_slice(dataname = "iris", varname = "Sepal.Length", id = "sepal_length"),
teal.slice::teal_slice(
dataname = "iris", id = "long_petals", title = "Long petals", expr = "Petal.Length > 5"
),
teal.slice::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 <- teal::init(
modules = list(
module("module1"),
module("module2")
),
data = list(iris, mtcars),
filter = filter
)
#> module "module1" server function takes no data so "datanames" will be ignored
#> module "module2" server function takes no data so "datanames" will be ignored
if (interactive()) {
shiny::runApp(app)
}