Learn R Programming

RastaRocket (version 1.1.2)

desc_ei_per_grade: desc_ei_per_grade

Description

A function to describe adverse events (AE) by grade.

Usage

desc_ei_per_grade(
  df_pat_grp,
  df_pat_grade,
  id_col = "USUBJID",
  group_col = "RDGRPNAME",
  ei_num_col = "EINUM",
  ei_grdm_col = "EIGRDM",
  ei_grav_col = "EIGRAV",
  severity = TRUE,
  digits = 1
)

Value

A gt table summarizing the AE by grade.

Arguments

df_pat_grp

A dataframe with two columns: USUBJID (Patient id) and RDGRPNAME (the RCT arm).

df_pat_grade

A dataframe with four columns: USUBJID (Patient id), EINUM (the AE id), EIGRDM (the AE grade) and EIGRAV (the AE severity which must be "Grave" and "Non grave").

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_grdm_col

AE grade column (default: "EIGRDM").

ei_grav_col

AE severity column (default: "EIGRAV").

severity

A boolean to show severe adverse event line or not (default: TRUE).

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_grade <- data.frame(USUBJID = c("ID_1", "ID_1",
                                      "ID_2",
                                      "ID_8",
                                      "ID_9"),
                           EINUM = c(1, 2,
                                      1,
                                      1,
                                      1),
                           EIGRDM = c(1, 3,
                                     4,
                                     2,
                                     4),
                           EIGRAV = c("Grave", "Non grave",
                                      "Non grave",
                                      "Non grave",
                                      "Grave"))

desc_ei_per_grade(df_pat_grp = df_pat_grp,
                  df_pat_grade = df_pat_grade)


Run the code above in your browser using DataLab