This 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:

  1. Patients Not Abnormal at baseline.

  2. Patients Abnormal at baseline.

  3. Total (all patients with a post-baseline assessment).

ard_tabulate_abnormal_by_baseline(
  data,
  postbaseline,
  baseline,
  abnormal,
  id = "USUBJID",
  by = NULL,
  strata = NULL
)

Arguments

data

(data.frame)
A data frame containing the clinical results.

postbaseline

(tidy-select)
Column name of the post-baseline reference range indicator (e.g., ANRIND).

baseline

(tidy-select)
Column name of the baseline reference range indicator (e.g., BNRIND).

abnormal

(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.

id

(tidy-select)
Column name for the subject identifier. Defaults to "USUBJID".

by

(tidy-select)
Optional column names for grouping variables (e.g., TRTA).

strata

(tidy-select)
Optional column names for additional stratification.

Value

An ARD data frame of class 'card'.

Examples

# 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
LBNRIND


    Not High 3 (42.9%) 3 (42.9%) 3 (50.0%)
    Not NA 0 (0.0%) 0 (0.0%) 0 (0.0%)
    Total 0 (0.0%) 0 (0.0%) 0 (0.0%)
1 n (%)