Add contrasts type for categorical variables
Add a contrasts column corresponding to contrasts used for a
categorical variable and a contrasts_type column equal to
"treatment", "sum", "poly", "helmert", "other" or "no.contrast".
tidy_add_contrasts(x, model = tidy_get_model(x), quiet = FALSE)
x |
a tidy tibble |
model |
the corresponding model, if not attached to |
quiet |
logical argument whether broom.helpers should not return a message when |
If the variable column is not yet available in x,
tidy_identify_variables() will be automatically applied.
Other tidy_helpers:
tidy_add_coefficients_type(),
tidy_add_estimate_to_reference_rows(),
tidy_add_header_rows(),
tidy_add_n(),
tidy_add_reference_rows(),
tidy_add_term_labels(),
tidy_add_variable_labels(),
tidy_attach_model(),
tidy_disambiguate_terms(),
tidy_identify_variables(),
tidy_plus_plus(),
tidy_remove_intercept(),
tidy_select_variables()
df <- Titanic %>%
dplyr::as_tibble() %>%
dplyr::mutate(Survived = factor(Survived, c("No", "Yes")))
df %>%
glm(
Survived ~ Class + Age + Sex,
data = ., weights = .$n, family = binomial,
contrasts = list(Age = contr.sum, Class = "contr.helmert")
) %>%
tidy_and_attach() %>%
tidy_add_contrasts()Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.