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_grade_max(
  df_ae,
  ...,
  df_enrol,
  type = c("stack", "dodge", "fill"),
  arm = "ARM",
  subjid = "SUBJID",
  soc = "AESOC",
  grade = "AEGR"
)

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)

type

the plots to be included. One of c("stack", "dodge", "fill").

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).

grade

name of the AE grade column in df_ae. Case-insensitive.

Value

a patchwork of ggplots

Examples

tm = edc_example_ae()
ae_plot_grade_max(df_ae=tm$ae, df_enrol=tm$enrolres, type=c("dodge", "fill"))

ae_plot_grade_max(df_ae=tm$ae, df_enrol=tm$enrolres, arm=NULL) + ggplot2::coord_flip()


#you can use modificators from the patchwork package, like "&"
if (FALSE) {
library(patchwork)
ae_plot_grade_max(df_ae=tm$ae, df_enrol=tm$enrolres) & labs(fill="Group")
}