Skip to contents

Summary tables for AE

Usage

ae_table_grade_n(
  df_ae,
  ...,
  df_enrol,
  arm = "ARM",
  grade = "AEGR",
  subjid = "SUBJID",
  soc = "AESOC",
  total = FALSE,
  digits = 0
)

Arguments

df_ae

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

...

unused

df_enrol

enrollment dataset, one row per patient, containing subjid (and arm if needed). All patients should be in this dataset.

arm

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

grade

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

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

total

whether to add a total column for each arm

digits

significant digits for percentages

Value

a crosstable

Examples

if (FALSE) { # \dontrun{
tm = edc_example_ae()

ae_table_grade_n(df_ae=tm$ae, df_enrol=tm$enrolres) %>% 
  as_flextable() %>% 
  flextable::add_footer_lines("Percentages are given as the proportion of patients 
                               presenting at least one AE of given grade")

ae_table_grade_n(df_ae=tm$ae, df_enrol=tm$enrolres, arm=NULL) %>% 
  as_flextable(by_header=F) %>% 
  flextable::set_header_labels(values=c("","","N (%)")) 
  
#To get SAE only, filter df_ae first
tm$ae %>% filter(sae==TRUE) %>% ae_table_grade_n(df_enrol=tm$enrolres, arm=NULL)
} # }