Typically used to add a row with overall AE counts to a table that primarily displays AE rates.
add_hierarchical_count_row(
x,
label = "Overall total number of events",
.before = NULL,
.after = NULL,
data_preprocess = identity
)(gtsummary)
a gtsummary table
(string)
label for the new row
(integer)
Row index where to add the new row. Default is after last row.
(function or formula)
a function that is applied to x$inputs$data before the total row counts
are tabulated. Default is identity. Tidyverse formula shortcut notation
for the function is accepted. See rlang::as_function() for details.
gtsummary table
# Example 1 ----------------------------------
cards::ADAE |>
# subset the data for a shorter example table
dplyr::slice(1:10) |>
tbl_hierarchical(
by = "TRTA",
variables = AEDECOD,
denominator = cards::ADSL,
id = "USUBJID",
overall_row = TRUE
) |>
add_hierarchical_count_row(.after = 1L)
Dictionary-Derived Term
Placebo
N = 861
Xanomeline High Dose
N = 841
1 n (%)