broom.helpers (version 1.0.0)

tidy_identify_variables: Identify the variable corresponding to each model coefficient

Description

tidy_identify_variables() will add to the tidy tibble three additional columns: variable, var_class and var_type.

Usage

tidy_identify_variables(
  x,
  model = tidy_get_model(x),
  quiet = FALSE,
  strict = FALSE
)

Arguments

x

a tidy tibble

model

the corresponding model, if not attached to x

quiet

logical argument whether broom.helpers should return an error when requested output cannot be generated. Default is FALSE

strict

logical argument whether broom.helpers should return an error when requested output cannot be generated. Default is FALSE

Details

It will also identify interaction terms and intercept(s). var_type could be "continuous", "categorical", "intercept" or "interaction". Will be equal to "unknown" in the rare cases where tidy_identify_variables() will fail to identify the list of variables.

See Also

model_identify_variables()

Other tidy_helpers: tidy_add_contrasts(), tidy_add_estimate_to_reference_rows(), tidy_add_header_rows(), tidy_add_reference_rows(), tidy_add_term_labels(), tidy_add_variable_labels(), tidy_attach_model(), tidy_plus_plus(), tidy_remove_intercept()

Examples

Run this code
# NOT RUN {
Titanic %>%
  dplyr::as_tibble() %>%
  dplyr::mutate(Survived = factor(Survived, c("No", "Yes"))) %>%
  glm(Survived ~ Class + Age * Sex, data = ., weights = .$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()
# }

Run the code above in your browser using DataLab