Code
lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by("ACTARM") %>%
split_rows_by("PARAM",
split_fun = drop_split_levels,
label_pos = "topleft",
split_label = obj_label(adlb_f$PARAM)
) %>%
count_abnormal(
var = "ANRIND",
abnormal = list(Low = c("LOW", "LOW LOW"), High = c("HIGH", "HIGH HIGH")),
exclude_base_abn = TRUE
) %>%
append_varlabels(adlb_f, "ANRIND", indent = 1L)
result <- build_table(lyt = lyt, df = adlb_f, alt_counts_df = adsl)
result
Laboratory Test A: Drug X B: Placebo C: Combination
Direction of Abnormality (N=134) (N=134) (N=132)
———————————————————————————————————————————————————————————————————————————————————————
Alanine Aminotransferase Measurement
Low 57/113 (50.4%) 62/117 (53%) 61/123 (49.6%)
High 0/134 0/134 0/132
C-Reactive Protein Measurement
Low 78/119 (65.5%) 71/113 (62.8%) 62/112 (55.4%)
High 69/114 (60.5%) 57/112 (50.9%) 58/115 (50.4%)
Immunoglobulin A Measurement
Low 0/134 0/134 0/132
High 64/119 (53.8%) 62/116 (53.4%) 62/113 (54.9%)