R/ard_tabulate_abnormal_by_baseline.R
ard_tabulate_abnormal_by_baseline.RdThis function creates an Analysis Results Data (ARD) object counting participants with abnormal assessments, stratified by their baseline status. For each abnormality (e.g., "Low", "High"), it calculates statistics for three tiers:
Patients Not Abnormal at baseline.
Patients Abnormal at baseline.
Total (all patients with a post-baseline assessment).
ard_tabulate_abnormal_by_baseline(
data,
postbaseline,
baseline,
abnormal,
id = "USUBJID",
by = NULL,
strata = NULL
)(data.frame)
A data frame containing the clinical results.
(tidy-select)
Column name of the post-baseline reference range indicator (e.g., ANRIND).
(tidy-select)
Column name of the baseline reference range indicator (e.g., BNRIND).
(list)
A named list of abnormalities (e.g., list(Low = c("LOW", "LOW LOW"))).
The name is used as the level label, and the vector contains the values in
postbaseline and baseline that define the abnormality.
(tidy-select)
Column name for the subject identifier. Defaults to "USUBJID".
(tidy-select)
Optional column names for grouping variables (e.g., TRTA).
(tidy-select)
Optional column names for additional stratification.
An ARD data frame of class 'card'.
# Example usage with ADLB-like data
adlb <- cards::ADLB
ard_tabulate_abnormal_by_baseline(
data = adlb,
postbaseline = LBNRIND,
baseline = BNRIND,
abnormal = list(Low = "LOW", High = "HIGH"),
by = TRTA
) %>% tbl_ard_summary(by = TRTA)
#> ℹ 3 rows with duplicated statistic values have been removed.
#> • See cards::bind_ard(.distinct) (`?cards::bind_ard()`) for details.
Characteristic
Placebo1
Xanomeline High Dose1
Xanomeline Low Dose1
1 n (%)