View source: R/tbl_ard_hierarchical.R
tbl_ard_hierarchical | R Documentation |
This is an preview of this function. There will be changes in the coming releases, and changes will not undergo a formal deprecation cycle.
Constructs tables from nested or hierarchical data structures (e.g. adverse events).
tbl_ard_hierarchical(
cards,
variables,
by = NULL,
include = everything(),
statistic = "{n} ({p})",
label = NULL
)
cards |
( |
variables |
( |
by |
( |
include |
( |
statistic |
( |
label |
( |
a gtsummary table of class "tbl_ard_hierarchical"
ADAE_subset <- cards::ADAE |>
dplyr::filter(
AESOC %in% unique(cards::ADAE$AESOC)[1:5],
AETERM %in% unique(cards::ADAE$AETERM)[1:5]
)
# Example 1: Event Rates --------------------
# First, build the ARD
ard <-
cards::ard_stack_hierarchical(
data = ADAE_subset,
variables = c(AESOC, AETERM),
by = TRTA,
denominator = cards::ADSL |> mutate(TRTA = ARM),
id = USUBJID
)
# Second, build table from the ARD
tbl_ard_hierarchical(
cards = ard,
variables = c(AESOC, AETERM),
by = TRTA
)
# Example 2: Event Counts -------------------
ard <-
cards::ard_stack_hierarchical_count(
data = ADAE_subset,
variables = c(AESOC, AETERM),
by = TRTA,
denominator = cards::ADSL |> mutate(TRTA = ARM)
)
tbl_ard_hierarchical(
cards = ard,
variables = c(AESOC, AETERM),
by = TRTA,
statistic = "{n}"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.