# NOT RUN {
ex1 <- lm(Sepal.Length ~ Sepal.Width + Species, data = iris) %>%
tidy_plus_plus()
ex1
df <- Titanic %>%
dplyr::as_tibble() %>%
dplyr::mutate(
Survived = factor(Survived, c("No", "Yes"))
) %>%
labelled::set_variable_labels(
Class = "Passenger's class",
Sex = "Gender"
)
ex2 <- glm(
Survived ~ Class + Age * Sex,
data = df, weights = df$n,
family = binomial
) %>%
tidy_plus_plus(exponentiate = TRUE)
ex2
if (requireNamespace("gtsummary")) {
ex3 <- glm(
response ~ poly(age, 3) + stage + grade * trt,
na.omit(gtsummary::trial),
family = binomial,
contrasts = list(
stage = contr.treatment(4, base = 3),
grade = contr.sum
)
) %>%
tidy_plus_plus(
exponentiate = TRUE,
variable_labels = c(age = "Age (in years)"),
add_header_rows = TRUE,
show_single_row = "trt",
term_labels = c("poly(age, 3)3" = "Cubic age"),
keep_model = TRUE
)
ex3
}
# }
Run the code above in your browser using DataLab