# Load Libraries & Data
library(cardinal)
adsl <- random.cdisc.data::cadsl
adae <- random.cdisc.data::cadae
# Pre-Processing - Ensure required variables fmqsc_var and fmqnam_var exist in adae
set.seed(1)
adae <- adae |>
dplyr::rename(FMQ01SC = SMQ01SC) |>
dplyr::mutate(
AESER = sample(c("Y", "N"), size = nrow(adae), replace = TRUE),
FMQ01NAM = sample(c("FMQ1", "FMQ2", "FMQ3"), size = nrow(adae), replace = TRUE)
)
adae$DCSREAS[is.na(adae$DCSREAS)] <- "ADVERSE EVENT"
adae$FMQ01SC[is.na(adae$FMQ01SC)] <- "NARROW"
# Output Table
make_table_11(df = adae, denominator = adsl, return_ard = FALSE)
FDA Table 11
Patients with FDA Medical Query (Narrow) Leading to Treatment Discontinuation, Safety Population, Pooled Analyses
gtsummary Table Setup
Body System or Organ Class FMQ (Narrow) |
A: Drug X N = 1341 |
B: Placebo N = 1341 |
C: Combination N = 1321 |
---|---|---|---|
Number of patients with event | 83 (62%) | 90 (67%) | 88 (67%) |
cl A.1 | 53 (40%) | 55 (41%) | 69 (52%) |
FMQ1 | 22 (16%) | 21 (16%) | 37 (28%) |
FMQ2 | 24 (18%) | 31 (23%) | 33 (25%) |
FMQ3 | 28 (21%) | 25 (19%) | 31 (23%) |
cl B.1 | 35 (26%) | 41 (31%) | 36 (27%) |
FMQ1 | 12 (9.0%) | 17 (13%) | 19 (14%) |
FMQ2 | 9 (6.7%) | 21 (16%) | 20 (15%) |
FMQ3 | 19 (14%) | 11 (8.2%) | 7 (5.3%) |
cl B.2 | 36 (27%) | 33 (25%) | 35 (27%) |
FMQ1 | 16 (12%) | 15 (11%) | 12 (9.1%) |
FMQ2 | 17 (13%) | 12 (9.0%) | 16 (12%) |
FMQ3 | 11 (8.2%) | 13 (9.7%) | 15 (11%) |
cl C.2 | 26 (19%) | 39 (29%) | 43 (33%) |
FMQ1 | 11 (8.2%) | 12 (9.0%) | 19 (14%) |
FMQ2 | 11 (8.2%) | 15 (11%) | 14 (11%) |
FMQ3 | 8 (6.0%) | 14 (10%) | 14 (11%) |
cl D.1 | 51 (38%) | 51 (38%) | 60 (45%) |
FMQ1 | 22 (16%) | 22 (16%) | 32 (24%) |
FMQ2 | 24 (18%) | 25 (19%) | 33 (25%) |
FMQ3 | 19 (14%) | 24 (18%) | 26 (20%) |
cl D.2 | 35 (26%) | 46 (34%) | 44 (33%) |
FMQ1 | 11 (8.2%) | 23 (17%) | 17 (13%) |
FMQ2 | 18 (13%) | 16 (12%) | 18 (14%) |
FMQ3 | 11 (8.2%) | 16 (12%) | 15 (11%) |
1 n (%) |
Function Details
make_table_11()
Required variables:
-
df
:USUBJID
,AEBODSYS
,AESER
,DCSREAS
, and the variables specified byarm_var
,saffl_var
,fmqsc_var
, andfmqnam_var
. -
denominator
(if specified):USUBJID
and the variables specified byarm_var
andsaffl_var
.
Argument | Description | Default |
df |
(data.frame ) Dataset (typically ADSL) required to build table. |
No default |
return_ard |
(flag ) Whether an ARD should be returned. |
TRUE |
denominator |
(character ) Alternative dataset used only to calculate column counts. |
NULL |
id_var |
(character ) Identifier variable used to count the participants within each flag. |
"USUBJID" |
arm_var |
(character ) Arm variable used to split table into columns. |
"ARM" |
saffl_var |
(character ) Flag variable used to indicate inclusion in safety population. |
"SAFFL" |
fmqsc_var |
(character ) FMQ scope variable to use in table. |
"FMQ01SC" |
fmqnam_var |
(character ) FMQ reference name variable to use in table. |
"FMQ01NAM" |
fmq_scope |
(character ) FMQ scope, can be ‘“NARROW”’ or ‘“BROAD”’. |
"NARROW" |
na_level |
(character ) String to represent missing values. |
"<Missing>" |
ARD Setup
# Load Libraries & Data
library(cardinal)
adsl <- random.cdisc.data::cadsl
adae <- random.cdisc.data::cadae
# Pre-Processing - Ensure required variables fmqsc_var and fmqnam_var exist in adae
set.seed(1)
adae <- adae |>
dplyr::rename(FMQ01SC = SMQ01SC) |>
dplyr::mutate(
AESER = sample(c("Y", "N"), size = nrow(adae), replace = TRUE),
FMQ01NAM = sample(c("FMQ1", "FMQ2", "FMQ3"), size = nrow(adae), replace = TRUE)
)
adae$DCSREAS[is.na(adae$DCSREAS)] <- "ADVERSE EVENT"
adae$FMQ01SC[is.na(adae$FMQ01SC)] <- "NARROW"
# Create Table & ARD
result <- make_table_11(df = adae, denominator = adsl)
# Output ARD
result$ard
{cards} data frame: 162 x 13
group1 group1_level group2 group2_level variable variable_level context stat_name stat_label stat fmt_fn warning error
1 ARM A: Drug X AEBODSYS cl A.1 FMQ01NAM FMQ1 hierarch… n n 29 0
2 ARM A: Drug X AEBODSYS cl A.1 FMQ01NAM FMQ1 hierarch… N N 134 0
3 ARM A: Drug X AEBODSYS cl A.1 FMQ01NAM FMQ1 hierarch… p % 0.216 <fn>
4 ARM B: Place… AEBODSYS cl A.1 FMQ01NAM FMQ1 hierarch… n n 28 0
5 ARM B: Place… AEBODSYS cl A.1 FMQ01NAM FMQ1 hierarch… N N 134 0
6 ARM B: Place… AEBODSYS cl A.1 FMQ01NAM FMQ1 hierarch… p % 0.209 <fn>
7 ARM C: Combi… AEBODSYS cl A.1 FMQ01NAM FMQ1 hierarch… n n 46 0
8 ARM C: Combi… AEBODSYS cl A.1 FMQ01NAM FMQ1 hierarch… N N 132 0
9 ARM C: Combi… AEBODSYS cl A.1 FMQ01NAM FMQ1 hierarch… p % 0.348 <fn>
10 ARM A: Drug X AEBODSYS cl B.1 FMQ01NAM FMQ1 hierarch… n n 13 0
11 ARM A: Drug X AEBODSYS cl B.1 FMQ01NAM FMQ1 hierarch… N N 134 0
12 ARM A: Drug X AEBODSYS cl B.1 FMQ01NAM FMQ1 hierarch… p % 0.097 <fn>
13 ARM B: Place… AEBODSYS cl B.1 FMQ01NAM FMQ1 hierarch… n n 17 0
14 ARM B: Place… AEBODSYS cl B.1 FMQ01NAM FMQ1 hierarch… N N 134 0
15 ARM B: Place… AEBODSYS cl B.1 FMQ01NAM FMQ1 hierarch… p % 0.127 <fn>
16 ARM C: Combi… AEBODSYS cl B.1 FMQ01NAM FMQ1 hierarch… n n 19 0
17 ARM C: Combi… AEBODSYS cl B.1 FMQ01NAM FMQ1 hierarch… N N 132 0
18 ARM C: Combi… AEBODSYS cl B.1 FMQ01NAM FMQ1 hierarch… p % 0.144 <fn>
19 ARM A: Drug X AEBODSYS cl B.2 FMQ01NAM FMQ1 hierarch… n n 19 0
20 ARM A: Drug X AEBODSYS cl B.2 FMQ01NAM FMQ1 hierarch… N N 134 0
21 ARM A: Drug X AEBODSYS cl B.2 FMQ01NAM FMQ1 hierarch… p % 0.142 <fn>
22 ARM B: Place… AEBODSYS cl B.2 FMQ01NAM FMQ1 hierarch… n n 18 0
23 ARM B: Place… AEBODSYS cl B.2 FMQ01NAM FMQ1 hierarch… N N 134 0
24 ARM B: Place… AEBODSYS cl B.2 FMQ01NAM FMQ1 hierarch… p % 0.134 <fn>
25 ARM C: Combi… AEBODSYS cl B.2 FMQ01NAM FMQ1 hierarch… n n 13 0
26 ARM C: Combi… AEBODSYS cl B.2 FMQ01NAM FMQ1 hierarch… N N 132 0
27 ARM C: Combi… AEBODSYS cl B.2 FMQ01NAM FMQ1 hierarch… p % 0.098 <fn>
28 ARM A: Drug X AEBODSYS cl C.2 FMQ01NAM FMQ1 hierarch… n n 14 0
29 ARM A: Drug X AEBODSYS cl C.2 FMQ01NAM FMQ1 hierarch… N N 134 0
30 ARM A: Drug X AEBODSYS cl C.2 FMQ01NAM FMQ1 hierarch… p % 0.104 <fn>
31 ARM B: Place… AEBODSYS cl C.2 FMQ01NAM FMQ1 hierarch… n n 12 0
32 ARM B: Place… AEBODSYS cl C.2 FMQ01NAM FMQ1 hierarch… N N 134 0
33 ARM B: Place… AEBODSYS cl C.2 FMQ01NAM FMQ1 hierarch… p % 0.09 <fn>
34 ARM C: Combi… AEBODSYS cl C.2 FMQ01NAM FMQ1 hierarch… n n 20 0
35 ARM C: Combi… AEBODSYS cl C.2 FMQ01NAM FMQ1 hierarch… N N 132 0
36 ARM C: Combi… AEBODSYS cl C.2 FMQ01NAM FMQ1 hierarch… p % 0.152 <fn>
37 ARM A: Drug X AEBODSYS cl D.1 FMQ01NAM FMQ1 hierarch… n n 26 0
38 ARM A: Drug X AEBODSYS cl D.1 FMQ01NAM FMQ1 hierarch… N N 134 0
39 ARM A: Drug X AEBODSYS cl D.1 FMQ01NAM FMQ1 hierarch… p % 0.194 <fn>
40 ARM B: Place… AEBODSYS cl D.1 FMQ01NAM FMQ1 hierarch… n n 26 0
41 ARM B: Place… AEBODSYS cl D.1 FMQ01NAM FMQ1 hierarch… N N 134 0
42 ARM B: Place… AEBODSYS cl D.1 FMQ01NAM FMQ1 hierarch… p % 0.194 <fn>
43 ARM C: Combi… AEBODSYS cl D.1 FMQ01NAM FMQ1 hierarch… n n 35 0
44 ARM C: Combi… AEBODSYS cl D.1 FMQ01NAM FMQ1 hierarch… N N 132 0
45 ARM C: Combi… AEBODSYS cl D.1 FMQ01NAM FMQ1 hierarch… p % 0.265 <fn>
46 ARM A: Drug X AEBODSYS cl D.2 FMQ01NAM FMQ1 hierarch… n n 12 0
47 ARM A: Drug X AEBODSYS cl D.2 FMQ01NAM FMQ1 hierarch… N N 134 0
48 ARM A: Drug X AEBODSYS cl D.2 FMQ01NAM FMQ1 hierarch… p % 0.09 <fn>
49 ARM B: Place… AEBODSYS cl D.2 FMQ01NAM FMQ1 hierarch… n n 24 0
50 ARM B: Place… AEBODSYS cl D.2 FMQ01NAM FMQ1 hierarch… N N 134 0
51 ARM B: Place… AEBODSYS cl D.2 FMQ01NAM FMQ1 hierarch… p % 0.179 <fn>
52 ARM C: Combi… AEBODSYS cl D.2 FMQ01NAM FMQ1 hierarch… n n 18 0
53 ARM C: Combi… AEBODSYS cl D.2 FMQ01NAM FMQ1 hierarch… N N 132 0
54 ARM C: Combi… AEBODSYS cl D.2 FMQ01NAM FMQ1 hierarch… p % 0.136 <fn>
55 ARM A: Drug X AEBODSYS cl A.1 FMQ01NAM FMQ2 hierarch… n n 31 0
56 ARM A: Drug X AEBODSYS cl A.1 FMQ01NAM FMQ2 hierarch… N N 134 0
57 ARM A: Drug X AEBODSYS cl A.1 FMQ01NAM FMQ2 hierarch… p % 0.231 <fn>
58 ARM B: Place… AEBODSYS cl A.1 FMQ01NAM FMQ2 hierarch… n n 36 0
59 ARM B: Place… AEBODSYS cl A.1 FMQ01NAM FMQ2 hierarch… N N 134 0
60 ARM B: Place… AEBODSYS cl A.1 FMQ01NAM FMQ2 hierarch… p % 0.269 <fn>
61 ARM C: Combi… AEBODSYS cl A.1 FMQ01NAM FMQ2 hierarch… n n 41 0
62 ARM C: Combi… AEBODSYS cl A.1 FMQ01NAM FMQ2 hierarch… N N 132 0
63 ARM C: Combi… AEBODSYS cl A.1 FMQ01NAM FMQ2 hierarch… p % 0.311 <fn>
64 ARM A: Drug X AEBODSYS cl B.1 FMQ01NAM FMQ2 hierarch… n n 10 0
65 ARM A: Drug X AEBODSYS cl B.1 FMQ01NAM FMQ2 hierarch… N N 134 0
66 ARM A: Drug X AEBODSYS cl B.1 FMQ01NAM FMQ2 hierarch… p % 0.075 <fn>
67 ARM B: Place… AEBODSYS cl B.1 FMQ01NAM FMQ2 hierarch… n n 23 0
68 ARM B: Place… AEBODSYS cl B.1 FMQ01NAM FMQ2 hierarch… N N 134 0
69 ARM B: Place… AEBODSYS cl B.1 FMQ01NAM FMQ2 hierarch… p % 0.172 <fn>
70 ARM C: Combi… AEBODSYS cl B.1 FMQ01NAM FMQ2 hierarch… n n 26 0
71 ARM C: Combi… AEBODSYS cl B.1 FMQ01NAM FMQ2 hierarch… N N 132 0
72 ARM C: Combi… AEBODSYS cl B.1 FMQ01NAM FMQ2 hierarch… p % 0.197 <fn>
73 ARM A: Drug X AEBODSYS cl B.2 FMQ01NAM FMQ2 hierarch… n n 18 0
74 ARM A: Drug X AEBODSYS cl B.2 FMQ01NAM FMQ2 hierarch… N N 134 0
75 ARM A: Drug X AEBODSYS cl B.2 FMQ01NAM FMQ2 hierarch… p % 0.134 <fn>
76 ARM B: Place… AEBODSYS cl B.2 FMQ01NAM FMQ2 hierarch… n n 12 0
77 ARM B: Place… AEBODSYS cl B.2 FMQ01NAM FMQ2 hierarch… N N 134 0
78 ARM B: Place… AEBODSYS cl B.2 FMQ01NAM FMQ2 hierarch… p % 0.09 <fn>
79 ARM C: Combi… AEBODSYS cl B.2 FMQ01NAM FMQ2 hierarch… n n 16 0
80 ARM C: Combi… AEBODSYS cl B.2 FMQ01NAM FMQ2 hierarch… N N 132 0
81 ARM C: Combi… AEBODSYS cl B.2 FMQ01NAM FMQ2 hierarch… p % 0.121 <fn>
82 ARM A: Drug X AEBODSYS cl C.2 FMQ01NAM FMQ2 hierarch… n n 11 0
83 ARM A: Drug X AEBODSYS cl C.2 FMQ01NAM FMQ2 hierarch… N N 134 0
84 ARM A: Drug X AEBODSYS cl C.2 FMQ01NAM FMQ2 hierarch… p % 0.082 <fn>
85 ARM B: Place… AEBODSYS cl C.2 FMQ01NAM FMQ2 hierarch… n n 17 0
86 ARM B: Place… AEBODSYS cl C.2 FMQ01NAM FMQ2 hierarch… N N 134 0
87 ARM B: Place… AEBODSYS cl C.2 FMQ01NAM FMQ2 hierarch… p % 0.127 <fn>
88 ARM C: Combi… AEBODSYS cl C.2 FMQ01NAM FMQ2 hierarch… n n 15 0
89 ARM C: Combi… AEBODSYS cl C.2 FMQ01NAM FMQ2 hierarch… N N 132 0
90 ARM C: Combi… AEBODSYS cl C.2 FMQ01NAM FMQ2 hierarch… p % 0.114 <fn>
91 ARM A: Drug X AEBODSYS cl D.1 FMQ01NAM FMQ2 hierarch… n n 32 0
92 ARM A: Drug X AEBODSYS cl D.1 FMQ01NAM FMQ2 hierarch… N N 134 0
93 ARM A: Drug X AEBODSYS cl D.1 FMQ01NAM FMQ2 hierarch… p % 0.239 <fn>
94 ARM B: Place… AEBODSYS cl D.1 FMQ01NAM FMQ2 hierarch… n n 28 0
95 ARM B: Place… AEBODSYS cl D.1 FMQ01NAM FMQ2 hierarch… N N 134 0
96 ARM B: Place… AEBODSYS cl D.1 FMQ01NAM FMQ2 hierarch… p % 0.209 <fn>
97 ARM C: Combi… AEBODSYS cl D.1 FMQ01NAM FMQ2 hierarch… n n 41 0
98 ARM C: Combi… AEBODSYS cl D.1 FMQ01NAM FMQ2 hierarch… N N 132 0
99 ARM C: Combi… AEBODSYS cl D.1 FMQ01NAM FMQ2 hierarch… p % 0.311 <fn>
100 ARM A: Drug X AEBODSYS cl D.2 FMQ01NAM FMQ2 hierarch… n n 20 0
101 ARM A: Drug X AEBODSYS cl D.2 FMQ01NAM FMQ2 hierarch… N N 134 0
102 ARM A: Drug X AEBODSYS cl D.2 FMQ01NAM FMQ2 hierarch… p % 0.149 <fn>
103 ARM B: Place… AEBODSYS cl D.2 FMQ01NAM FMQ2 hierarch… n n 18 0
104 ARM B: Place… AEBODSYS cl D.2 FMQ01NAM FMQ2 hierarch… N N 134 0
105 ARM B: Place… AEBODSYS cl D.2 FMQ01NAM FMQ2 hierarch… p % 0.134 <fn>
106 ARM C: Combi… AEBODSYS cl D.2 FMQ01NAM FMQ2 hierarch… n n 19 0
107 ARM C: Combi… AEBODSYS cl D.2 FMQ01NAM FMQ2 hierarch… N N 132 0
108 ARM C: Combi… AEBODSYS cl D.2 FMQ01NAM FMQ2 hierarch… p % 0.144 <fn>
109 ARM A: Drug X AEBODSYS cl A.1 FMQ01NAM FMQ3 hierarch… n n 36 0
110 ARM A: Drug X AEBODSYS cl A.1 FMQ01NAM FMQ3 hierarch… N N 134 0
111 ARM A: Drug X AEBODSYS cl A.1 FMQ01NAM FMQ3 hierarch… p % 0.269 <fn>
112 ARM B: Place… AEBODSYS cl A.1 FMQ01NAM FMQ3 hierarch… n n 28 0
113 ARM B: Place… AEBODSYS cl A.1 FMQ01NAM FMQ3 hierarch… N N 134 0
114 ARM B: Place… AEBODSYS cl A.1 FMQ01NAM FMQ3 hierarch… p % 0.209 <fn>
115 ARM C: Combi… AEBODSYS cl A.1 FMQ01NAM FMQ3 hierarch… n n 42 0
116 ARM C: Combi… AEBODSYS cl A.1 FMQ01NAM FMQ3 hierarch… N N 132 0
117 ARM C: Combi… AEBODSYS cl A.1 FMQ01NAM FMQ3 hierarch… p % 0.318 <fn>
118 ARM A: Drug X AEBODSYS cl B.1 FMQ01NAM FMQ3 hierarch… n n 19 0
119 ARM A: Drug X AEBODSYS cl B.1 FMQ01NAM FMQ3 hierarch… N N 134 0
120 ARM A: Drug X AEBODSYS cl B.1 FMQ01NAM FMQ3 hierarch… p % 0.142 <fn>
121 ARM B: Place… AEBODSYS cl B.1 FMQ01NAM FMQ3 hierarch… n n 11 0
122 ARM B: Place… AEBODSYS cl B.1 FMQ01NAM FMQ3 hierarch… N N 134 0
123 ARM B: Place… AEBODSYS cl B.1 FMQ01NAM FMQ3 hierarch… p % 0.082 <fn>
124 ARM C: Combi… AEBODSYS cl B.1 FMQ01NAM FMQ3 hierarch… n n 7 0
125 ARM C: Combi… AEBODSYS cl B.1 FMQ01NAM FMQ3 hierarch… N N 132 0
126 ARM C: Combi… AEBODSYS cl B.1 FMQ01NAM FMQ3 hierarch… p % 0.053 <fn>
127 ARM A: Drug X AEBODSYS cl B.2 FMQ01NAM FMQ3 hierarch… n n 11 0
128 ARM A: Drug X AEBODSYS cl B.2 FMQ01NAM FMQ3 hierarch… N N 134 0
129 ARM A: Drug X AEBODSYS cl B.2 FMQ01NAM FMQ3 hierarch… p % 0.082 <fn>
130 ARM B: Place… AEBODSYS cl B.2 FMQ01NAM FMQ3 hierarch… n n 14 0
131 ARM B: Place… AEBODSYS cl B.2 FMQ01NAM FMQ3 hierarch… N N 134 0
132 ARM B: Place… AEBODSYS cl B.2 FMQ01NAM FMQ3 hierarch… p % 0.104 <fn>
133 ARM C: Combi… AEBODSYS cl B.2 FMQ01NAM FMQ3 hierarch… n n 15 0
134 ARM C: Combi… AEBODSYS cl B.2 FMQ01NAM FMQ3 hierarch… N N 132 0
135 ARM C: Combi… AEBODSYS cl B.2 FMQ01NAM FMQ3 hierarch… p % 0.114 <fn>
136 ARM A: Drug X AEBODSYS cl C.2 FMQ01NAM FMQ3 hierarch… n n 10 0
137 ARM A: Drug X AEBODSYS cl C.2 FMQ01NAM FMQ3 hierarch… N N 134 0
138 ARM A: Drug X AEBODSYS cl C.2 FMQ01NAM FMQ3 hierarch… p % 0.075 <fn>
139 ARM B: Place… AEBODSYS cl C.2 FMQ01NAM FMQ3 hierarch… n n 14 0
140 ARM B: Place… AEBODSYS cl C.2 FMQ01NAM FMQ3 hierarch… N N 134 0
141 ARM B: Place… AEBODSYS cl C.2 FMQ01NAM FMQ3 hierarch… p % 0.104 <fn>
142 ARM C: Combi… AEBODSYS cl C.2 FMQ01NAM FMQ3 hierarch… n n 14 0
143 ARM C: Combi… AEBODSYS cl C.2 FMQ01NAM FMQ3 hierarch… N N 132 0
144 ARM C: Combi… AEBODSYS cl C.2 FMQ01NAM FMQ3 hierarch… p % 0.106 <fn>
145 ARM A: Drug X AEBODSYS cl D.1 FMQ01NAM FMQ3 hierarch… n n 19 0
146 ARM A: Drug X AEBODSYS cl D.1 FMQ01NAM FMQ3 hierarch… N N 134 0
147 ARM A: Drug X AEBODSYS cl D.1 FMQ01NAM FMQ3 hierarch… p % 0.142 <fn>
148 ARM B: Place… AEBODSYS cl D.1 FMQ01NAM FMQ3 hierarch… n n 32 0
149 ARM B: Place… AEBODSYS cl D.1 FMQ01NAM FMQ3 hierarch… N N 134 0
150 ARM B: Place… AEBODSYS cl D.1 FMQ01NAM FMQ3 hierarch… p % 0.239 <fn>
151 ARM C: Combi… AEBODSYS cl D.1 FMQ01NAM FMQ3 hierarch… n n 27 0
152 ARM C: Combi… AEBODSYS cl D.1 FMQ01NAM FMQ3 hierarch… N N 132 0
153 ARM C: Combi… AEBODSYS cl D.1 FMQ01NAM FMQ3 hierarch… p % 0.205 <fn>
154 ARM A: Drug X AEBODSYS cl D.2 FMQ01NAM FMQ3 hierarch… n n 12 0
155 ARM A: Drug X AEBODSYS cl D.2 FMQ01NAM FMQ3 hierarch… N N 134 0
156 ARM A: Drug X AEBODSYS cl D.2 FMQ01NAM FMQ3 hierarch… p % 0.09 <fn>
157 ARM B: Place… AEBODSYS cl D.2 FMQ01NAM FMQ3 hierarch… n n 16 0
158 ARM B: Place… AEBODSYS cl D.2 FMQ01NAM FMQ3 hierarch… N N 134 0
159 ARM B: Place… AEBODSYS cl D.2 FMQ01NAM FMQ3 hierarch… p % 0.119 <fn>
160 ARM C: Combi… AEBODSYS cl D.2 FMQ01NAM FMQ3 hierarch… n n 18 0
161 ARM C: Combi… AEBODSYS cl D.2 FMQ01NAM FMQ3 hierarch… N N 132 0
162 ARM C: Combi… AEBODSYS cl D.2 FMQ01NAM FMQ3 hierarch… p % 0.136 <fn>
rtables Table Setup
# Load Libraries & Data
library(cardinal)
adsl <- random.cdisc.data::cadsl
adae <- random.cdisc.data::cadae
# Pre-Processing - Ensure required variables fmqsc_var and fmqnam_var exist in adae
set.seed(1)
adae <- adae |>
dplyr::rename(FMQ01SC = SMQ01SC) |>
dplyr::mutate(
AESER = sample(c("Y", "N"), size = nrow(adae), replace = TRUE),
FMQ01NAM = sample(c("FMQ1", "FMQ2", "FMQ3"), size = nrow(adae), replace = TRUE)
)
adae$DCSREAS[is.na(adae$DCSREAS)] <- "ADVERSE EVENT"
adae$FMQ01SC[is.na(adae$FMQ01SC)] <- "NARROW"
# Output Table
risk_diff <- list(arm_x = "B: Placebo", arm_y = "A: Drug X") # optional
make_table_11_rtables(df = adae, alt_counts_df = adsl, risk_diff = risk_diff)
Body System or Organ Class A: Drug X B: Placebo C: Combination Risk Difference (%) (95% CI)
FMQ (Narrow) (N=134) (N=134) (N=132) (N=268)
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
Patients with at least one AE leading to discontinuation 83 (61.9%) 90 (67.2%) 88 (66.7%) 5.2 (-6.2 - 16.7)
cl A.1 53 (39.6%) 55 (41.0%) 69 (52.3%) 1.5 (-10.3 - 13.2)
FMQ1 22 (16.4%) 21 (15.7%) 37 (28.0%) -0.7 (-9.5 - 8.0)
FMQ2 24 (17.9%) 31 (23.1%) 33 (25.0%) 5.2 (-4.4 - 14.9)
FMQ3 28 (20.9%) 25 (18.7%) 31 (23.5%) -2.2 (-11.8 - 7.3)
cl B.1 35 (26.1%) 41 (30.6%) 36 (27.3%) 4.5 (-6.3 - 15.3)
FMQ1 12 (9.0%) 17 (12.7%) 19 (14.4%) 3.7 (-3.7 - 11.2)
FMQ2 9 (6.7%) 21 (15.7%) 20 (15.2%) 9.0 (1.5 - 16.4)
FMQ3 19 (14.2%) 11 (8.2%) 7 (5.3%) -6.0 (-13.5 - 1.5)
cl B.2 36 (26.9%) 33 (24.6%) 35 (26.5%) -2.2 (-12.7 - 8.2)
FMQ1 16 (11.9%) 15 (11.2%) 12 (9.1%) -0.7 (-8.4 - 6.9)
FMQ2 17 (12.7%) 12 (9.0%) 16 (12.1%) -3.7 (-11.2 - 3.7)
FMQ3 11 (8.2%) 13 (9.7%) 15 (11.4%) 1.5 (-5.3 - 8.3)
cl C.2 26 (19.4%) 39 (29.1%) 43 (32.6%) 9.7 (-0.5 - 19.9)
FMQ1 11 (8.2%) 12 (9.0%) 19 (14.4%) 0.7 (-6.0 - 7.5)
FMQ2 11 (8.2%) 15 (11.2%) 14 (10.6%) 3.0 (-4.1 - 10.1)
FMQ3 8 (6.0%) 14 (10.4%) 14 (10.6%) 4.5 (-2.1 - 11.0)
cl D.1 51 (38.1%) 51 (38.1%) 60 (45.5%) 0.0 (-11.6 - 11.6)
FMQ1 22 (16.4%) 22 (16.4%) 32 (24.2%) 0.0 (-8.9 - 8.9)
FMQ2 24 (17.9%) 25 (18.7%) 33 (25.0%) 0.7 (-8.5 - 10.0)
FMQ3 19 (14.2%) 24 (17.9%) 26 (19.7%) 3.7 (-5.0 - 12.5)
cl D.2 35 (26.1%) 46 (34.3%) 44 (33.3%) 8.2 (-2.7 - 19.2)
FMQ1 11 (8.2%) 23 (17.2%) 17 (12.9%) 9.0 (1.1 - 16.9)
FMQ2 18 (13.4%) 16 (11.9%) 18 (13.6%) -1.5 (-9.5 - 6.5)
FMQ3 11 (8.2%) 16 (11.9%) 15 (11.4%) 3.7 (-3.5 - 10.9)
Function Details
make_table_11_rtables()
Required variables:
-
df
:USUBJID
,AEBODSYS
,AESER
,DCSREAS
, and the variables specified byarm_var
,saffl_var
,fmqsc_var
, andfmqnam_var
. -
alt_counts_df
(if specified):USUBJID
and the variables specified byarm_var
andsaffl_var
.
Argument | Description | Default |
adae |
(data.frame ) Dataset (typically ADAE) required to build table. |
No default |
alt_counts_df |
(character ) Alternative dataset used only to calculate column counts. |
NULL |
show_colcounts |
(flag ) Whether column counts should be printed. |
TRUE |
arm_var |
(character ) Arm variable used to split table into columns. |
"ARM" |
saffl_var |
(character ) Flag variable used to indicate inclusion in safety population. |
"SAFFL" |
fmqsc_var |
(character ) FMQ scope variable to use in table. |
"FMQ01SC" |
fmqnam_var |
(character ) FMQ reference name variable to use in table. |
"FMQ01NAM" |
fmq_scope |
(character ) FMQ scope, can be ‘“NARROW”’ or ‘“BROAD”’. |
"NARROW" |
lbl_overall |
(character ) If specified, an overall column will be added to the table with the given value as the column label. |
NULL |
risk_diff |
(named
|
NULL |
prune_0 |
(flag ) Whether all-zero rows should be removed from the table. |
FALSE |
na_level |
(character ) String to represent missing values. |
"<Missing>" |
annotations |
(named list of character ) List of annotations to add to the table. Valid annotation types are title , subtitles , main_footer , and prov_footer. Each name-value pair should use the annotation type as name and the desired string as value. |
NULL |