Function adapted from gtforester::tbl_subgroups().
tbl_roche_subgroups(data, rsp, by, subgroups, .tbl_fun)(data.frame, survey.design)
a data frame or survey object
(tidy-select)
Variable to use in responder rate calculations.
(tidy-select)
Variable to make comparison between groups.
(tidy-select)
Variables to perform stratified analyses for.
(function)
A function or formula. If a function, it is used as is.
If a formula, e.g. ~ .x %>% tbl_summary() %>% add_p(), it is converted to a function.
The stratified data frame is passed to this function.
a 'gtsummary' table
if (FALSE) { # identical(Sys.getenv("NOT_CRAN"), "true")
tbl <-
trial |>
tbl_roche_subgroups(
rsp = "response",
by = "trt",
subgroups = c("grade", "stage"),
.tbl_fun =
~ glm(response ~ trt, data = .x) |>
tbl_regression(
show_single_row = trt,
exponentiate = TRUE
)
)
tbl
}