Learn R Programming

RastaRocket (version 1.1.2)

desc_ei_per_pt: desc_ei_per_pt

Description

A function to describe AE by soc and pt

Usage

desc_ei_per_pt(
  df_pat_grp,
  df_pat_llt,
  id_col = "USUBJID",
  group_col = "RDGRPNAME",
  ei_num_col = "EINUM",
  ei_llt_col = "EILLTN",
  ei_soc_col = "EISOCPN",
  ei_pt_col = "EIPTN",
  language = "fr",
  order_by_freq = TRUE,
  digits = 1
)

Value

A gt table

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)

id_col

Patient id column (default: "USUBJID").

group_col

group column, the rct arm (default: "RDGRPNAME").

ei_num_col

AE id column (default: "EINUM").

ei_llt_col

AE LLT column (default: "EILLTN").

ei_soc_col

AE SOC column (default: "EISOCPN").

ei_pt_col

AE PT column (default: "EIPTN")

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

Examples

Run this code
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)

Run the code above in your browser using DataLab