Code
# Define the split function
split_fun <- drop_split_levels
lyt <- basic_table() %>%
split_cols_by("ARM") %>%
summarize_patients_events_in_cols(
custom_label = "Total number of patients with at least one non-serious adverse event occuring at a relative frequency of >=5% and number of events"
) %>%
split_rows_by("AEBODSYS",
nested = FALSE,
split_fun = split_fun,
indent_mod = -1L,
label_pos = "topleft",
split_label = obj_label(adae_trim$AEBODSYS)
) %>%
split_rows_by("AEDECOD", split_fun = split_fun, label_pos = "topleft", split_label = obj_label(adae_trim$AEDECOD)) %>%
summarize_patients_events_in_cols(
col_split = FALSE
)
result <- build_table(lyt, adae_trim)
result
Body System or Organ Class A: Drug X B: Placebo C: Combination
Dictionary-Derived Term Patients (All) Events (All) Patients (All) Events (All) Patients (All) Events (All)
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
Total number of patients with at least one non-serious adverse event occuring at a relative frequency of >=5% and number of events 106 360 112 367 112 421
cl A.1
dcd A.1.1.1.1 50 64 45 62 63 88
cl B.2
dcd B.2.1.2.1 49 65 44 62 52 66
cl C.1
dcd C.1.1.1.3 43 55 46 63 43 64
cl C.2
dcd C.2.1.2.1 35 48 48 53 55 65
cl D.1
dcd D.1.1.4.2 48 66 42 55 50 64
cl D.2
dcd D.2.1.5.3 47 62 58 72 57 74