EmptyFilterState | R Documentation |
FilterState
object for empty variablesFilterState
subclass representing an empty variable.
teal.slice::FilterState
-> EmptyFilterState
new()
Initialize EmptyFilterState
object.
EmptyFilterState$new( x, x_reactive = reactive(NULL), extract_type = character(0), slice )
x
(vector
)
variable to be filtered,
x_reactive
(reactive
)
returning vector of the same type as x
. Is used to update
counts following the change in values of the filtered dataset.
If it is set to reactive(NULL)
then counts based on filtered
dataset are not shown.
extract_type
(character
)
specifying whether condition calls should be prefixed by dataname
. Possible values:
character(0)
(default) varname
in the condition call will not be prefixed
"list"
varname
in the condition call will be returned as <dataname>$<varname>
"matrix"
varname
in the condition call will be returned as <dataname>[, <varname>]
slice
(teal_slice
)
specification of this filter state.
teal_slice
is stored in the object and set_state
directly manipulates values within teal_slice
.
get_state
returns teal_slice
object which can be reused in other places.
Note that teal_slice
is a reactiveValues
, which means it has reference semantics, i.e.
changes made to an object are automatically reflected in all places that refer to the same teal_slice
.
Object of class EmptyFilterState
, invisibly.
get_call()
Returns reproducible condition call for current selection relevant for selected variable type. Uses internal reactive values, hence must be called in reactive or isolated context.
EmptyFilterState$get_call(dataname)
dataname
name of data set; defaults to private$get_dataname()
logical(1)
clone()
The objects of this class are cloneable with this method.
EmptyFilterState$clone(deep = FALSE)
deep
Whether to make a deep clone.
# use non-exported function from teal.slice
include_js_files <- getFromNamespace("include_js_files", "teal.slice")
EmptyFilterState <- getFromNamespace("EmptyFilterState", "teal.slice")
library(shiny)
filter_state <- EmptyFilterState$new(
x = NA,
slice = teal_slice(varname = "x", dataname = "data"),
extract_type = character(0)
)
isolate(filter_state$get_call())
filter_state$set_state(teal_slice(dataname = "data", varname = "x", keep_na = TRUE))
isolate(filter_state$get_call())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.