Produce a graphic representation of AE, counting AE as bars for each patient, colored by grade. Can be faceted by treatment arm.
adverse event dataset, one row per AE, containing subjid, soc, and grade.
unused
enrollment dataset, one row per patient, containing subjid (and arm if needed). All patients should be in this dataset.
one or several of c("max", "sup", "eq")
. max
computes the maximum AE grade per patient, sup
computes the number of patients having experienced at least one AE of grade higher or equal to X, and eq
computes the number of patients having experienced at least one AE of grade equal to X.
Position adjustment (cf. ggplot2::geom_col()
)
whether to present patients as proportions (relative
) or as counts (absolute
)
name of the treatment column in df_enrol
. Case-insensitive. Can be set to NULL
.
name of the AE grade column in df_ae
. Case-insensitive.
name of the patient ID in both df_ae
and df_enrol
. Case-insensitive.
whether to add a total
column for each arm.
a ggplot
tm = grstat_example()
attach(tm, warn.conflicts=FALSE)
ae_plot_grade(df_ae=ae, df_enrol=enrolres)
ae_plot_grade(df_ae=ae, df_enrol=enrolres, arm="ARM", variant=c("sup", "max"))
ae_plot_grade(df_ae=ae, df_enrol=enrolres, arm="ARM", type="absolute")
ae_plot_grade(df_ae=ae, df_enrol=enrolres, arm="ARM", position="fill")
ae_plot_grade(df_ae=ae, df_enrol=enrolres, arm="ARM", position="stack", type="absolute")