The same demographics summary as cdisc_saf_demo, but in the long
Analysis Results Data (ARD) format produced by
cards::ard_stack(). One row per (treatment arm, variable,
statistic). Shipped as a teaching dataset that shows the upstream
shape users typically have when they start from cards. Convert
it to the wide form tabular() accepts via pivot_across() —
tabular itself does not consume the long ARD format, since
pre-summarised wide data is the package boundary.
Format
A card-classed tibble with columns group1,
group1_level, variable, variable_level, context,
stat_name, stat_label, stat. group1 == "TRT01A" and
group1_level carries the original pharmaverseadam arm labels
("Placebo", "Xanomeline Low Dose", "Xanomeline High Dose").
cards::ard_stack(.overall = TRUE) adds overall rows with
group1_level = NA; pivot_across() renders those into a
Total column.
Source
Derived in data-raw/bundle-demo.R via
cards::ard_stack(.by = "TRT01A", .overall = TRUE) over
pharmaverseadam::adsl.
Details
Continuous variables: AGE, WEIGHT, HEIGHT, BMI (each
emitting N, mean, sd, median, p25, p75, min, max).
Categorical variables: AGEGR1, SEX, RACE, ETHNIC,
BMI_CAT (each emitting n, N, p).
This is the package's canonical flat ARD demo. Its hierarchical
counterpart is cdisc_saf_aesocpt_ard; together they cover both shapes
pivot_across() must handle.
See also
pivot_across() for the long-to-wide bridge;
cdisc_saf_demo for the wide companion.
Examples
# 95% demographics pattern: cards ARD -> wide -> rendered table.
n <- stats::setNames(cdisc_saf_n$n, cdisc_saf_n$arm_short)
cdisc_saf_demo_ard |>
pivot_across(
statistic = list(
continuous = "{mean} ({sd})",
categorical = "{n} ({p}%)"
),
label = c(AGE = "Age (years)", SEX = "Sex", RACE = "Race")
) |>
tabular(
titles = c(
"Table 14.1.1",
"Demographics",
"Safety Population"
)
)
Table 14.1.1
Demographics
Safety Population
variable stat_label Placebo Xanomeline High Dose Xanomeline Low Dose Total Age (years) AGE 75.2 (8.59) 73.8 (7.94) 76.0 (8.11) 75.1 (8.25) WEIGHT WEIGHT 62.8 (12.77) 69.5 (14.35) 68.0 (14.50) 66.6 (14.13) HEIGHT HEIGHT 162.6 (11.52) 165.9 (10.28) 163.7 (10.30) 163.9 (10.76) BMI BMI 23.6 (3.67) 25.2 (3.97) 25.2 (4.40) 24.7 (4.09) AGEGR1 18-64 14 (16%) 11 (15%) 8 (8%) 33 (13%) AGEGR1 >64 72 (84%) 61 (85%) 88 (92%) 221 (87%) Sex F 53 (62%) 35 (49%) 55 (57%) 143 (56%) Sex M 33 (38%) 37 (51%) 41 (43%) 111 (44%) Race WHITE 78 (91%) 62 (86%) 90 (94%) 230 (91%) Race BLACK OR AFRICAN AMERICAN 8 (9%) 9 (12%) 6 (6%) 23 (9%) Race ASIAN 0 0 0 0 Race AMERICAN INDIAN OR ALASKA NATIVE 0 1 (1%) 0 1 (0%) ETHNIC HISPANIC OR LATINO 3 (3%) 3 (4%) 6 (6%) 12 (5%) ETHNIC NOT HISPANIC OR LATINO 83 (97%) 69 (96%) 90 (94%) 242 (95%) ETHNIC NOT REPORTED 0 0 0 0 BMI_CAT Underweight (<18.5) 3 (3%) 1 (1%) 4 (4%) 8 (3%) BMI_CAT Normal (18.5-24.9) 57 (66%) 39 (54%) 46 (48%) 142 (56%) BMI_CAT Overweight (25-29.9) 20 (23%) 23 (32%) 32 (34%) 75 (30%) BMI_CAT Obese (>=30) 6 (7%) 9 (12%) 13 (14%) 28 (11%)