if (FALSE) { # interactive()
df <- Titanic %>%
dplyr::as_tibble() %>%
dplyr::mutate(Survived = factor(Survived, c("No", "Yes"))) %>%
labelled::set_variable_labels(
Class = "Passenger's class",
Sex = "Sex"
)
mod <- df %>%
glm(Survived ~ Class * Age * Sex, data = ., weights = .$n, family = binomial)
mod %>%
tidy_and_attach() %>%
tidy_add_term_labels()
mod %>%
tidy_and_attach() %>%
tidy_add_term_labels(
interaction_sep = " x ",
categorical_terms_pattern = "{level} / {reference_level}"
)
}
Run the code above in your browser using DataLab