teal_slices {teal.slice} | R Documentation |
Complete filter specification
Description
Create teal_slices
object to package multiple filters and additional settings.
Check out teal_slices-utilities
functions for working with teal_slices
object.
Usage
teal_slices(
...,
exclude_varnames = NULL,
include_varnames = NULL,
count_type = NULL,
allow_add = TRUE
)
Arguments
... |
any number of |
include_varnames , exclude_varnames |
( |
count_type |
This is a new feature. Do kindly share your opinions on
(
|
allow_add |
( |
Details
teal_slices()
collates multiple teal_slice
objects into a teal_slices
object,
a complete filter specification. This is used by all classes above FilterState
as well as filter_panel_api
wrapper functions.
teal_slices
has attributes that modify the behavior of the filter panel, which are resolved by different classes.
include_varnames
and exclude_varnames
determine which variables can have filters assigned.
The former enumerates allowed variables, the latter enumerates forbidden values.
Since these could be mutually exclusive, it is impossible to set both allowed and forbidden
variables for one data set in one teal_slices
.
Value
teal_slices
, which is an unnamed list of teal_slice
objects.
See Also
-
teal_slice
for creating constituent elements ofteal_slices
-
teal::slices_store
for robust utilities for saving and loadingteal_slices
inJSON
format -
is.teal_slices
,as.teal_slices
,as.list.teal_slices
, [[.teal_slices
],c.teal_slices
print.teal_slices
,format.teal_slices
Examples
filter_1 <- teal_slice(
dataname = "dataname1",
varname = "varname1",
choices = letters,
selected = "b",
keep_na = TRUE,
fixed = FALSE,
extra1 = "extraone"
)
filter_2 <- teal_slice(
dataname = "dataname1",
varname = "varname2",
choices = 1:10,
keep_na = TRUE,
selected = 2,
fixed = TRUE,
anchored = FALSE,
extra2 = "extratwo"
)
filter_3 <- teal_slice(
dataname = "dataname2",
varname = "varname3",
choices = 1:10 / 10,
keep_na = TRUE,
selected = 0.2,
fixed = TRUE,
anchored = FALSE,
extra1 = "extraone",
extra2 = "extratwo"
)
all_filters <- teal_slices(
filter_1,
filter_2,
filter_3,
exclude_varnames = list(
"dataname1" = "varname2"
)
)
is.teal_slices(all_filters)
all_filters[1:2]
c(all_filters[1], all_filters[2])
print(all_filters)
print(all_filters, trim_lines = FALSE)