| restrict_facets | R Documentation |
Postprocessing split function behavior to generally restrict facets
restrict_facets(
facets,
op = c("keep", "exclude"),
reorder = TRUE,
quiet = FALSE
)
facets |
|
op |
|
reorder |
|
quiet |
|
This is a function factory which creates a post-process
behavioral building block for use in make_split_fun().
This factory provides the equivalent of both keep_split_levels
and remove_split_levels in a form suitable for use in
make_split_fun().
When op is "keep" (the default), resulting facets are
restricted to only those named in facets when the generated
function is applied to a split result; in the case of "exclude",
facets named in facets are removed so that only those not named
remain.
The generated function will throw a warning if any of facets are
not found in the split result it receives during splitting, unless
it was created with quiet = FALSE.
a function suitable for use within the post argument of
make_split_fun().
make_split_fun()
Other make_custom_split:
add_combo_facet(),
drop_facet_levels(),
make_split_fun(),
make_split_result(),
trim_levels_in_facets()
keep_spl <- make_split_fun(post = list(restrict_facets(c("M", "F"), op = "keep")))
lyt <- basic_table() |>
split_cols_by("SEX", split_fun = keep_spl) |>
analyze("AGE")
build_table(lyt, ex_adsl)
excl_undiff <- restrict_facets("UNDIFFERENTIATED", op = "exclude")
excl_spl <- make_split_fun(post = list(excl_undiff))
lyt <- basic_table() |>
split_cols_by("SEX", split_fun = excl_spl) |>
analyze("AGE")
build_table(lyt, ex_adsl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.