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"),
  proportion = TRUE,
  drop_levels = FALSE,
  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").

drop_levels

whether to drop unused grade levels.

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)
#> Warning: Returning more (or less) than 1 row per `summarise()` group was deprecated in
#> dplyr 1.1.0.
#>  Please use `reframe()` instead.
#>  When switching from `summarise()` to `reframe()`, remember that `reframe()`
#>   always returns an ungrouped data frame and adjust accordingly.
#>  The deprecated feature was likely used in the EDCimport package.
#>   Please report the issue at <https://github.com/DanChaltiel/EDCimport/issues>.

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

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")
}