Skip to contents

Produces a graphic representation of AE, counting the maximum grade each patient experienced, colored by treatment arm. Returns up to 3 representations if arm!=NULL.

Usage

ae_plot_soc(
  df_ae,
  ...,
  df_enrol,
  arm = "ARM",
  subjid = "SUBJID",
  soc = "AESOC",
  severe = "SEVERE"
)

Arguments

df_ae

adverse event table, one row per AE, containing subjid, soc, and grade

...

unused

df_enrol

enrollment table, one row per patient, containing subjid (and arm if needed)

arm

name of the treatment column in df_enrol. Case-insensitive. Can be set to NULL to not group.

subjid

name of the patient ID in both df_ae and df_enrol. Case-insensitive.

soc

name of the SOC column in df_ae. Case-insensitive. Grade will be considered 0 if missing(e.g. if patient if absent from df_ae).

severe

name of the logical column in df_ae telling wheter an AE is severe. Case-insensitive.

Value

a crosstable (dataframe)

Details

The function ae_plot_soc() creates a summary table of the maximum AE grade experienced per each patient. The resulting crosstable can be piped to as_flextable() to get a nicely formatted flextable.

Examples


tm = edc_example_ae()
#> Warning: Option "edc_lookup" has been overwritten.
tm$ae %>% 
  #dplyr::mutate(severe = aeser=="Yes") %>% 
  dplyr::mutate(severe = aegr>=3) %>% 
  ae_plot_soc(df_enrol=tm$enrolres)