Code
tbl <- basic_table(show_colcounts = TRUE) %>%
split_cols_by("ACTARMCD") %>%
split_rows_by("PARAMCAT") %>%
split_rows_by("PARAM", split_fun = drop_split_levels, child_labels = "hidden") %>%
count_occurrences(
vars = "AVALC_FORMAT",
.stats = c("fraction"),
denom = "n",
drop = TRUE
) %>%
build_table(anl, alt_counts_df = adsl)
criteria_fun <- function(tr) {
row_label <- obj_label(tr)
ifelse(row_label == "Criteria not met", TRUE, FALSE)
}
result <- tbl %>% trim_rows(criteria = criteria_fun)
result
ARM A ARM B ARM C
(N=134) (N=134) (N=132)
———————————————————————————————————————————————————————————————————————————
Total Bilirubin <= 2xULN
ALT >3xULN at 2 Visits 25/134 (18.7%) 20/134 (14.9%) 27/132 (20.5%)
AST >3xULN at 2 Visits 22/134 (16.4%) 14/134 (10.4%) 37/132 (28.0%)
Total Bilirubin > 2xULN
ALT >3xULN at 2 Visits 26/134 (19.4%) 31/134 (23.1%) 23/132 (17.4%)
AST >3xULN at 2 Visits 30/134 (22.4%) 27/134 (20.1%) 26/132 (19.7%)