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