scope_tidy | R Documentation |
This function uses the information from a model tidy tibble to generate
a data frame exposing the different variables of the model,
data frame that could be used for tidy selection. In addition, columns
"var_type"
, "var_class"
and "contrasts_type"
are scoped and their
values are added as attributes to the data frame.
For example, if var_type='continuous'
for variable "age"
, then the
attribute attr(.$age, 'gtsummary.var_type') <- 'continuous'
is set.
That attribute is then used in a selector like all_continuous()
.
Note: attributes are prefixed with "gtsummary."
to be compatible with
selectors provided by {gtsummary}
.
scope_tidy(x, data = NULL)
x |
( |
data |
( |
A data frame.
mod <- lm(Sepal.Length ~ Sepal.Width * Species, data = iris)
tt <- mod |> tidy_and_attach() |> tidy_add_contrasts()
scope_tidy(tt) |> str()
scope_tidy(tt, data = model_get_model_frame(mod)) |> str()
scope_tidy(tt) |> dplyr::select(dplyr::starts_with("Se")) |> names()
scope_tidy(tt) |> dplyr::select(where(is.factor)) |> names()
scope_tidy(tt) |> dplyr::select(all_continuous()) |> names()
scope_tidy(tt) |> dplyr::select(all_contrasts()) |> names()
scope_tidy(tt) |> dplyr::select(all_interaction()) |> names()
scope_tidy(tt) |> dplyr::select(all_intercepts()) |> names()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.