Stacks two or more gtsummary objects
Assists in patching together more complex tables. tbl_stack()
appends two
or more tbl_regression
, tbl_summary
, tbl_svysummary
, or tbl_merge
objects.
Column attributes, including number formatting and column footnotes, are
retained from the first passed gtsummary object.
tbl_stack(tbls, group_header = NULL, quiet = NULL)
tbls |
List of gtsummary objects |
group_header |
Character vector with table headers where length matches
the length of |
quiet |
Logical indicating whether to print messages in console. Default is
|
A tbl_stack
object
Example 1
Example 2
Daniel D. Sjoberg
Other tbl_summary tools:
add_n.tbl_summary()
,
add_overall()
,
add_p.tbl_summary()
,
add_q()
,
add_stat_label()
,
bold_italicize_labels_levels
,
inline_text.tbl_summary()
,
inline_text.tbl_survfit()
,
modify
,
tbl_merge()
,
tbl_summary()
Other tbl_svysummary tools:
add_n.tbl_summary()
,
add_overall()
,
add_p.tbl_svysummary()
,
add_q()
,
add_stat_label()
,
modify
,
tbl_merge()
,
tbl_svysummary()
Other tbl_regression tools:
add_global_p()
,
add_q()
,
bold_italicize_labels_levels
,
combine_terms()
,
inline_text.tbl_regression()
,
modify
,
tbl_merge()
,
tbl_regression()
Other tbl_uvregression tools:
add_global_p()
,
add_q()
,
bold_italicize_labels_levels
,
inline_text.tbl_uvregression()
,
modify
,
tbl_merge()
,
tbl_uvregression()
Other tbl_survfit tools:
add_n.tbl_survfit()
,
add_nevent.tbl_survfit()
,
add_p.tbl_survfit()
,
modify
,
tbl_merge()
,
tbl_survfit()
# Example 1 ---------------------------------- # stacking two tbl_regression objects t1 <- glm(response ~ trt, trial, family = binomial) %>% tbl_regression( exponentiate = TRUE, label = list(trt ~ "Treatment (unadjusted)") ) t2 <- glm(response ~ trt + grade + stage + marker, trial, family = binomial) %>% tbl_regression( include = "trt", exponentiate = TRUE, label = list(trt ~ "Treatment (adjusted)") ) tbl_stack_ex1 <- tbl_stack(list(t1, t2)) # Example 2 ---------------------------------- # stacking two tbl_merge objects library(survival) t3 <- coxph(Surv(ttdeath, death) ~ trt, trial) %>% tbl_regression( exponentiate = TRUE, label = list(trt ~ "Treatment (unadjusted)") ) t4 <- coxph(Surv(ttdeath, death) ~ trt + grade + stage + marker, trial) %>% tbl_regression( include = "trt", exponentiate = TRUE, label = list(trt ~ "Treatment (adjusted)") ) # first merging, then stacking row1 <- tbl_merge(list(t1, t3), tab_spanner = c("Tumor Response", "Death")) row2 <- tbl_merge(list(t2, t4)) tbl_stack_ex2 <- tbl_stack(list(row1, row2), group_header = c("Unadjusted Analysis", "Adjusted Analysis"))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.