# NOT RUN {
df <- Titanic %>%
dplyr::as_tibble() %>%
dplyr::mutate(Survived = factor(Survived, c("No", "Yes"))) %>%
labelled::set_variable_labels(
Class = "Passenger's class",
Sex = "Sex"
)
df %>%
glm(Survived ~ Class * Age * Sex, data = ., weights = .$n, family = binomial) %>%
tidy_and_attach() %>%
tidy_add_variable_labels(
labels = list(Sex = "Gender", "Class:Age" = "Custom label")
)
# }
Run the code above in your browser using DataCamp Workspace