library(dplyr)
ADSL <- ex_adsl |> select(USUBJID, ARM, SEX)
ADAE <- ex_adae |> select(USUBJID, ARM, SEX, AEBODSYS, AEDECOD)
ADAE <- ADAE |>
mutate(TRTEMFL = "Y")
lyt <- basic_table(show_colcounts = TRUE) |>
split_cols_by("ARM") |>
analyze("SEX",
show_labels = "visible",
afun = a_freq_resp_var_j,
extra_args = list(resp_var = "TRTEMFL", riskdiff = FALSE)
)
result <- build_table(lyt, df = ADAE, alt_counts_df = ADSL)
result
Run the code above in your browser using DataLab