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 toNULL
to not group.- subjid
name of the patient ID in both
df_ae
anddf_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 fromdf_ae
).- grade
name of the AE grade column in
df_ae
. Case-insensitive.
See also
ae_table_grade_max()
, ae_table_grade_n()
, ae_table_soc()
, ae_plot_grade_max()
, ae_plot_grade_n()
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")
}