Functions ard_hierarchical()
and ard_hierarchical_count()
are primarily helper
functions for ard_stack_hierarchical()
and ard_stack_hierarchical_count()
,
meaning that it will be rare a user needs to call
ard_hierarchical()
/ard_hierarchical_count()
directly.
Performs hierarchical or nested tabulations, e.g. tabulates AE terms nested within AE system organ class.
ard_hierarchical()
includes summaries for the last variable listed
in the variables
argument, nested within the other variables included.
ard_hierarchical_count()
includes summaries for all variables
listed in the variables
argument each summary nested within the preceding
variables, e.g. variables=c(AESOC, AEDECOD)
summarizes AEDECOD
nested
in AESOC
, and also summarizes the counts of AESOC
.
ard_hierarchical(data, ...)ard_hierarchical_count(data, ...)
# S3 method for data.frame
ard_hierarchical(
data,
variables,
by = dplyr::group_vars(data),
statistic = everything() ~ c("n", "N", "p"),
denominator = NULL,
fmt_fn = NULL,
stat_label = everything() ~ default_stat_labels(),
id = NULL,
...
)
# S3 method for data.frame
ard_hierarchical_count(
data,
variables,
by = dplyr::group_vars(data),
fmt_fn = NULL,
stat_label = everything() ~ default_stat_labels(),
...
)
an ARD data frame of class 'card'
(data.frame
)
a data frame
Arguments passed to methods.
(tidy-select
)
variables to perform the nested/hierarchical tabulations within.
(tidy-select
)
variables to perform tabulations by. All combinations of the variables
specified here appear in results. Default is dplyr::group_vars(data)
.
(formula-list-selector
)
a named list, a list of formulas,
or a single formula where the list element one or more of c("n", "N", "p", "n_cum", "p_cum")
(on the RHS of a formula).
(data.frame
, integer
)
used to define the denominator and enhance the output.
The argument is required for ard_hierarchical()
and optional
for ard_hierarchical_count()
.
the univariate tabulations of the by
variables are calculated with denominator
,
when a data frame is passed, e.g. tabulation of the treatment assignment
counts that may appear in the header of a table.
the denominator
argument must be specified when id
is used to
calculate the event rates.
(formula-list-selector
)
a named list, a list of formulas,
or a single formula where the list element is a named list of functions
(or the RHS of a formula),
e.g. list(mpg = list(mean = \(x) round(x, digits = 2) |> as.character()))
.
(formula-list-selector
)
a named list, a list of formulas, or a single formula where
the list element is either a named list or a list of formulas defining the
statistic labels, e.g. everything() ~ list(n = "n", p = "pct")
or
everything() ~ list(n ~ "n", p ~ "pct")
.
(tidy-select
)
an optional argument used to assert there are no duplicates within
the c(id, variables)
columns.
ard_hierarchical(
data = ADAE |>
dplyr::slice_tail(n = 1L, by = c(USUBJID, TRTA, AESOC, AEDECOD)),
variables = c(AESOC, AEDECOD),
by = TRTA,
id = USUBJID,
denominator = ADSL |> dplyr::rename(TRTA = ARM)
)
ard_hierarchical_count(
data = ADAE,
variables = c(AESOC, AEDECOD),
by = TRTA
)
Run the code above in your browser using DataLab