View source: R/tbl_strata_nested_stack.R
tbl_strata_nested_stack | R Documentation |
This function stratifies your data frame, builds gtsummary tables, and
stacks the resulting tables in a nested style. The underlying functionality
is similar to tbl_strata()
, except the resulting tables are nested or indented
within each group.
tbl_strata_nested_stack(
data,
strata,
.tbl_fun,
...,
row_header = "{strata}",
quiet = FALSE
)
data |
( |
strata |
( |
.tbl_fun |
( |
... |
Additional arguments passed on to the |
row_header |
( |
quiet |
a stacked 'gtsummary' table
# Example 1 ----------------------------------
tbl_strata_nested_stack(
trial,
strata = trt,
.tbl_fun = ~ .x |>
tbl_summary(include = c(age, grade), missing = "no") |>
modify_header(all_stat_cols() ~ "**Summary Statistics**")
)
# Example 2 ----------------------------------
tbl_strata_nested_stack(
trial,
strata = trt,
.tbl_fun = ~ .x |>
tbl_summary(include = c(age, grade), missing = "no") |>
modify_header(all_stat_cols() ~ "**Summary Statistics**"),
row_header = "{strata}, n={n}"
) |>
# bold the row headers; print `x$table_body` to see hidden columns
modify_bold(columns = "label", rows = tbl_indent_id1 > 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.