Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

tidy_select_variables

Select variables to keep/drop


Description

Will remove unselected variables from the results. To remove the intercept, use tidy_remove_intercept().

Usage

tidy_select_variables(x, include = everything(), model = tidy_get_model(x))

Arguments

x

a tidy tibble

include

variables to include. Accepts tidyselect syntax. Use - to remove a variable. Default is everything(). See also all_continuous(), all_categorical(), all_dichotomous() and all_interaction()

model

the corresponding model, if not attached to x

Details

If the variable column is not yet available in x, tidy_identify_variables() will be automatically applied.

See Also

Examples

res <- Titanic %>%
  dplyr::as_tibble() %>%
  dplyr::mutate(Survived = factor(Survived)) %>%
  glm(Survived ~ Class + Age * Sex, data = ., weights = .$n, family = binomial) %>%
  tidy_and_attach() %>%
  tidy_identify_variables()

res
res %>% tidy_select_variables()
res %>% tidy_select_variables(include = "Class")
res %>% tidy_select_variables(include = -c("Age", "Sex"))
res %>% tidy_select_variables(include = starts_with("A"))
res %>% tidy_select_variables(include = all_categorical())
res %>% tidy_select_variables(include = all_dichotomous())
res %>% tidy_select_variables(include = all_interaction())
res %>% tidy_select_variables(
  include = c("Age", all_categorical(dichotomous = FALSE), all_interaction())
)

broom.helpers

Helpers for Model Coefficients Tibbles

v1.3.0
GPL-3
Authors
Joseph Larmarange [aut, cre] (<https://orcid.org/0000-0001-7097-700X>), Daniel D. Sjoberg [aut] (<https://orcid.org/0000-0003-0862-2018>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.