| as.picks | R Documentation |
Helper functions to ease transition between
teal.transform::data_extract_spec() and picks().
as.picks(x, quiet = FALSE)
teal_transform_filter(x, label = "Filter")
x |
( |
quiet |
( |
label |
( |
With introduction of picks, data_extract_spec will no longer serve a primary tool to
define variable choices and default selection in teal-modules and eventually data_extract_spec
will be deprecated.
To ease the transition to the new tool, we provide as.picks method which can handle 1:1
conversion from data_extract_spec to picks. Unfortunately, when data_extract_spec
contains filter_spec then as.picks is unable to provide reliable picks equivalent.
A picks object when conversion is possible, otherwise NULL with a warning (if quiet = FALSE).
# convert des with eager select_spec
as.picks(
teal.transform::data_extract_spec(
dataname = "iris",
teal.transform::select_spec(
choices = c("Sepal.Length", "Sepal.Width", "Species"),
selected = c("Sepal.Length", "Species"),
multiple = TRUE,
ordered = TRUE
)
)
)
# convert des with delayed select_spec
as.picks(
teal.transform::data_extract_spec(
dataname = "iris",
teal.transform::select_spec(
choices = teal.transform::variable_choices("iris"),
selected = teal.transform::first_choice(),
multiple = TRUE,
ordered = TRUE
)
)
)
as.picks(
teal.transform::data_extract_spec(
dataname = "iris",
teal.transform::select_spec(
choices = teal.transform::variable_choices(
"iris",
subset = function(data) names(Filter(is.numeric, data))
),
selected = teal.transform::first_choice(),
multiple = TRUE,
ordered = TRUE
)
)
)
# teal_transform_module build on teal.transform
teal_transform_filter(
teal.transform::data_extract_spec(
dataname = "iris",
filter = teal.transform::filter_spec(
vars = "Species",
choices = c("setosa", "versicolor", "virginica"),
selected = c("setosa", "versicolor")
)
)
)
teal_transform_filter(
picks(
datasets(choices = "iris", select = "iris"),
variables(choices = "Species", "Species"),
values(
choices = c("setosa", "versicolor", "virginica"),
selected = c("setosa", "versicolor")
)
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.