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 20/134 (14.9%) 21/134 (15.7%) 20/132 (15.2%)
AST >3xULN at 2 Visits 30/134 (22.4%) 25/134 (18.7%) 27/132 (20.5%)
Total Bilirubin > 2xULN
ALT >3xULN at 2 Visits 24/134 (17.9%) 32/134 (23.9%) 24/132 (18.2%)
AST >3xULN at 2 Visits 33/134 (24.6%) 29/134 (21.6%) 25/132 (18.9%)