View source: R/tidy_identify_variables.R
tidy_identify_variables | R Documentation |
tidy_identify_variables()
will add to the tidy tibble
three additional columns: variable
, var_class
, var_type
and var_nlevels
.
tidy_identify_variables(x, model = tidy_get_model(x), quiet = FALSE)
x |
( |
model |
(a model object, e.g. |
quiet |
( |
It will also identify interaction terms and intercept(s).
var_type
could be:
"continuous"
,
"dichotomous"
(categorical variable with 2 levels),
"categorical"
(categorical variable with 3 levels or more),
"intercept"
"interaction"
"ran_pars
(random-effect parameters for mixed models)
"ran_vals"
(random-effect values for mixed models)
"unknown"
in the rare cases where tidy_identify_variables()
will fail to identify the list of variables
For dichotomous and categorical variables, var_nlevels
corresponds to the number
of original levels in the corresponding variables.
For fixest
models, a new column instrumental
is added to indicate
instrumental variables.
model_identify_variables()
Other tidy_helpers:
tidy_add_coefficients_type()
,
tidy_add_contrasts()
,
tidy_add_estimate_to_reference_rows()
,
tidy_add_header_rows()
,
tidy_add_n()
,
tidy_add_pairwise_contrasts()
,
tidy_add_reference_rows()
,
tidy_add_term_labels()
,
tidy_add_variable_labels()
,
tidy_attach_model()
,
tidy_disambiguate_terms()
,
tidy_group_by()
,
tidy_plus_plus()
,
tidy_remove_intercept()
,
tidy_select_variables()
df <- Titanic |>
dplyr::as_tibble() |>
dplyr::mutate(Survived = factor(Survived, c("No", "Yes")))
glm(
Survived ~ Class + Age * Sex,
data = df,
weights = df$n,
family = binomial
) |>
tidy_and_attach() |>
tidy_identify_variables()
lm(
Sepal.Length ~ poly(Sepal.Width, 2) + Species,
data = iris,
contrasts = list(Species = contr.sum)
) |>
tidy_and_attach(conf.int = TRUE) |>
tidy_identify_variables()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.