A function to describe AE by soc and pt

desc_ei_per_pt(
  df_pat_grp,
  df_pat_llt,
  language = "fr",
  order_by_freq = TRUE,
  digits = 1
)

Arguments

df_pat_grp

A dataframe with two columns: id_pat and grp (the rct arm)

df_pat_llt

A dataframe with two columns: id_pat (patient id), num_ae (AE id), llt (AE LLT), pt (AE PT), soc (AE)

language

'fr' default or 'en'

order_by_freq

Logical. Should PT and SOC be ordered by frequency? Defaults to TRUE. If FALSE, PT and SOC are ordered alphabetically.

digits

Number of digits for percentages

Value

A gt table

Examples

df_pat_grp <- data.frame(USUBJID = paste0("ID_", 1:10),
                         RDGRPNAME = c(rep("A", 3), rep("B", 3), rep("C", 4)))

df_pat_llt <- data.frame(USUBJID = c("ID_1", "ID_1",
                                    "ID_2",
                                    "ID_4",
                                    "ID_9"),
                         EINUM = c(1, 2, 1, 1, 1),
                         EILLTN = c("llt1", "llt1",
                                 "llt4", "llt3",
                                 "llt1"),
                         EIPTN = c("Arrhythmia", "Myocardial Infarction",
                                 "Arrhythmia", "Pneumonia",
                                 "Pneumonia"),
                         EISOCPN = c("Cardiac Disorders", "Cardiac Disorders",
                                 "Cardiac Disorders", "Infections",
                                 "Infections"))

desc_ei_per_pt(df_pat_grp = df_pat_grp,
               df_pat_llt = df_pat_llt)
Evénements indésirables
Total
A
B
C
AE
N (%)
Patient
N (%)
AE
N (%)
Patient
N (%)
AE
N (%)
Patient
N (%)
AE
N (%)
Patient
N (%)
Total
Total 5 (100.0) 4 (40.0) 3 (100.0) 2 (66.7) 1 (100.0) 1 (33.3) 1 (100.0) 1 (25.0)
Cardiac Disorders
Total 3 ( 60.0) 2 (20.0) 3 (100.0) 2 (66.7)



Arrhythmia 2 ( 40.0) 2 (20.0) 2 ( 66.7) 2 (66.7)



Myocardial Infarction 1 ( 20.0) 1 (10.0) 1 ( 33.3) 1 (33.3)



Infections
Total 2 ( 40.0) 2 (20.0)

1 (100.0) 1 (33.3) 1 (100.0) 1 (25.0)
Pneumonia 2 ( 40.0) 2 (20.0)

1 (100.0) 1 (33.3) 1 (100.0) 1 (25.0)