Summary tables for AE
ae_table_grade(
df_ae,
...,
df_enrol,
variant = c("max", "sup", "eq"),
arm = NULL,
grade = "AEGR",
subjid = "SUBJID",
percent = TRUE,
digits = 2,
total = TRUE
)
adverse event dataset, one row per AE, containing subjid, soc, and grade.
unused
enrollment dataset, one row per patient, containing subjid (and arm if needed). All patients should be in this dataset.
one or several of c("max", "sup", "eq")
. max
computes the maximum AE grade per patient, sup
computes the number of patients having experienced at least one AE of grade higher or equal to X, and eq
computes the number of patients having experienced at least one AE of grade equal to X.
name of the treatment column in df_enrol
. Case-insensitive. Can be set to NULL
.
name of the AE grade column in df_ae
. Case-insensitive.
name of the patient ID in both df_ae
and df_enrol
. Case-insensitive.
whether to show percentages with counts. Defaults to TRUE. Can also be "only" to not show counts.
significant digits for percentages.
whether to add a total
column for each arm.
a crosstable
ae_table_grade()
, ae_table_soc()
, ae_plot_grade()
, ae_plot_grade_sum()
, butterfly_plot()
tm = grstat_example()
attach(tm, warn.conflicts=FALSE)
ae_table_grade(df_ae=ae, df_enrol=enrolres, arm=NULL) %>%
as_flextable(header_show_n=TRUE)
label
variable
Treatment arm
All patients (N=50)
Patient maximum AE grade
No declared AE
3 (6%)
Grade 1
4 (8%)
Grade 2
10 (20%)
Grade 3
18 (36%)
Grade 4
9 (18%)
Grade 5
6 (12%)
Patient had at least one AE of grade
No declared AE
3 (6%)
Grade ≥ 1
47 (94%)
Grade ≥ 2
43 (86%)
Grade ≥ 3
33 (66%)
Grade ≥ 4
15 (30%)
Grade = 5
6 (12%)
Patient had at least one AE of grade
No declared AE
3 (6%)
Grade 1
28 (56%)
Grade 2
25 (50%)
Grade 3
27 (54%)
Grade 4
11 (22%)
Grade 5
6 (12%)
ae_table_grade(df_ae=ae, df_enrol=enrolres, arm="ARM") %>%
as_flextable(header_show_n=TRUE)
label
variable
arm
Total
Ctl (N=27)
Trt (N=23)
Patient maximum AE grade
No declared AE
0 (0%)
3 (13%)
3 (6%)
Grade 1
3 (11%)
1 (4%)
4 (8%)
Grade 2
5 (19%)
5 (22%)
10 (20%)
Grade 3
10 (37%)
8 (35%)
18 (36%)
Grade 4
8 (30%)
1 (4%)
9 (18%)
Grade 5
1 (4%)
5 (22%)
6 (12%)
Patient had at least one AE of grade
No declared AE
0 (0%)
3 (13%)
3 (6%)
Grade ≥ 1
27 (100%)
20 (87%)
47 (94%)
Grade ≥ 2
24 (89%)
19 (83%)
43 (86%)
Grade ≥ 3
19 (70%)
14 (61%)
33 (66%)
Grade ≥ 4
9 (33%)
6 (26%)
15 (30%)
Grade = 5
1 (4%)
5 (22%)
6 (12%)
Patient had at least one AE of grade
No declared AE
0 (0%)
3 (13%)
3 (6%)
Grade 1
15 (56%)
13 (57%)
28 (56%)
Grade 2
17 (63%)
8 (35%)
25 (50%)
Grade 3
14 (52%)
13 (57%)
27 (54%)
Grade 4
8 (30%)
3 (13%)
11 (22%)
Grade 5
1 (4%)
5 (22%)
6 (12%)
#To get SAE only, filter df_ae first
library(dplyr)
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
ae %>%
filter(sae=="Yes") %>%
ae_table_grade(df_enrol=enrolres, arm="ARM") %>%
mutate_all(~stringr::str_replace(.x, "AE", "SAE")) %>%
as_flextable(header_show_n=TRUE)
label
variable
arm
Total
Ctl (N=27)
Trt (N=23)
Patient maximum SAE grade
No declared SAE
18 (67%)
20 (87%)
38 (76%)
Grade 1
3 (11%)
1 (4%)
4 (8%)
Grade 2
3 (11%)
0 (0%)
3 (6%)
Grade 3
1 (4%)
1 (4%)
2 (4%)
Grade 4
2 (7%)
0 (0%)
2 (4%)
Grade 5
0 (0%)
1 (4%)
1 (2%)
Patient had at least one SAE of grade
No declared SAE
18 (67%)
20 (87%)
38 (76%)
Grade ≥ 1
9 (33%)
3 (13%)
12 (24%)
Grade ≥ 2
6 (22%)
2 (9%)
8 (16%)
Grade ≥ 3
3 (11%)
2 (9%)
5 (10%)
Grade ≥ 4
2 (7%)
1 (4%)
3 (6%)
Grade = 5
0 (0%)
1 (4%)
1 (2%)
Patient had at least one SAE of grade
No declared SAE
18 (67%)
20 (87%)
38 (76%)
Grade 1
3 (11%)
1 (4%)
4 (8%)
Grade 2
4 (15%)
0 (0%)
4 (8%)
Grade 3
1 (4%)
1 (4%)
2 (4%)
Grade 4
2 (7%)
0 (0%)
2 (4%)
Grade 5
0 (0%)
1 (4%)
1 (2%)