-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcreate_status_tables.R
331 lines (326 loc) · 13.8 KB
/
create_status_tables.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# build study status tables
library(tidyverse)
# need 2 arm study
# build status2 table for 2-arm Indomethacin PEP
# NEJM 2012; 366:1414-1422
# Elmunzer, Higgins, et al.
## build status2 ----
status2 <- tibble(randomized = c(rep("yes", 602),
rep(NA, 197)),
excluded_reason = c(rep(NA, 602), #must match randomized = Yes
rep("Did not meet inclusion criteria", 169),
rep("Met Exclusion Criteria", 11),
rep("Did not Undergo ERCP", 17)),
arm = c(rep("Placebo", 307),
rep("Indomethacin", 295),
rep(NA, 197) # must match randomized = No
),
recieved_int = c(rep("yes", 307),
"No",
rep("yes", 294),
rep(NA, 197) ),
dnr_int_reason = c(rep(NA, 307),
rep(NA, 295),
rep(NA, 197)),
completed = c(rep("yes", 307),
rep(NA, 1),
rep("yes", 294),
rep(NA, 197) ),
discont_reason = c(rep(NA, 307),
"Could not hold Suppository",
rep(NA, 294),
rep(NA, 197) ),
analyzed = c(rep("yes", 602),
rep(NA, 197) ),
not_an_reason = rep(NA, 799) )
# now shuffle rows
set.seed(42)
rows <- sample(nrow(status2))
status2 <- status2[rows, ]
# now add study_id, formatted as "00X"
status2$study_id <- str_pad(1L:799L, width = 5,
side = "left", pad = "0")
status2 <- status2 %>% relocate(study_id)
status2
## build status3 ----
# need 3 arm study
# build status3 table for 3-arm SONIC trial
# NEJM 2010; 362:1383-1395
status3 <- tibble(randomized = c(rep("yes", 508),
rep(NA, 309)),
excluded_reason = c(rep(NA, 508), #must match randomized = Yes
rep("Were not eligible", 266),
rep("Withdrew consent", 29),
rep("Lost to follow up", 8),
rep("Had other reasons", 3),
rep("Adverse Event", 2),
rep("Died", 1)),
arm = c(rep("Azathioprine + Placebo Infusions", 170),
rep("Infliximab + Placebo Tablets", 169),
rep("Infliximab + Azathioprine", 169),
rep(NA, 309) # must match randomized = No
),
received_int = c(rep("yes", 508),
rep(NA, 309)),
dnr_int_reason = c(rep(NA, 508),
rep(NA, 309)),
completed = c(rep("Completed", 86),
rep(NA, 84),
rep("Completed", 111),
rep(NA, 58),
rep("Completed", 121),
rep(NA,48),
rep(NA, 309)),
discont_reason = c(rep(NA, 86),
rep("Were not eligible", 3),
rep("Withdrew consent", 18),
rep("Had an adverse event", 38),
rep("Were lost to follow up", 5),
rep("Had other reasons", 19),
rep("Died", 1),
rep(NA, 111),
rep("Were not eligible", 8),
rep("Withdrew consent", 9),
rep("Had an adverse event", 20),
rep("Were lost to follow up", 5),
rep("Had other reasons", 16),
rep(NA, 121),
rep("Were not eligible", 2),
rep("Withdrew consent", 7),
rep("Had an adverse event", 28),
rep("Were lost to follow up", 2),
rep("Had other reasons", 9),
rep(NA, 309)),
analyzed = c(rep("yes", 817)),
not_analyzed = c(rep(NA, 817))) # must match randomized = No
# now shuffle rows
set.seed(42)
rows <- sample(nrow(status3))
status3 <- status3[rows, ]
# now add study_id, formatted as "000X"
status3$study_id <- str_pad(1L:817L, width = 6,
side = "left", pad = "0")
status3 <- status3 %>% relocate(study_id)
status3
## build status4 ----
# need 4 arm study
# build status4 table for 4-arm Tofa for UC
# Gut 2017;66:1049–1059.
# Panes, Higgins, et al.
# https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5532457/pdf/gutjnl-2016-312735.pdf
status4 <- tibble(randomized = c(rep("yes", 280),
rep(NA, 287)),
excluded_reason = c(rep(NA, 280),
rep("Did not meet criteria", 287)),
arm = c(rep("Placebo", 92),
rep("Tofacitinib 5 mg BID", 86),
rep("Tofacitinib 10 mg BID", 86),
rep("Tofacitinib 15 mg BID", 16),
rep(NA, 287)),
received_int = c(rep("yes", 280),
rep(NA, 287)),
dnr_int_reason = c(rep(NA, 280),
rep(NA, 287)),
completed = c(rep("yes", 74),
rep(NA, 18),
rep("yes", 74), # 5 bid
rep(NA, 12),
rep("yes", 74), # 10 bid
rep(NA, 12),
rep("yes", 15), #15 bid
NA,
rep(NA, 287)),
discont_reason = c(rep(NA, 73), #PBO
rep("Lost to follow up", 1),
rep("Adverse Event", 2),
rep("Insufficient Clinical Response", 6),
rep("No longer willing to participate", 6),
rep("Protocol violation", 1),
rep("Did not meet entry criteria", 2),
rep("Other reasons", 1),
rep(NA, 74), # tofa 5 bid
rep("Lost to follow up", 1),
rep("Adverse Event", 1),
rep("Insufficient Clinical Response", 6),
rep("No longer willing to participate", 4),
rep(NA, 74), # tofa 10 bid
rep("Lost to follow up", 1),
rep("Adverse Event", 5),
rep("Insufficient Clinical Response", 4),
rep("Protocol Violation", 2),
rep(NA, 15), # 15 bid
rep("Insufficient Clinical Response", 1),
rep(NA, 287)),
analyzed = c(rep("yes", 280),
rep(NA, 287)),
not_analyzed = c(rep(NA, 567)))
# now shuffle rows
set.seed(42)
rows <- sample(nrow(status4))
status4 <- status4[rows, ]
# now add study_id, formatted as "00X"
status4$study_id <- str_pad(1L:567L, width = 5,
side = "left", pad = "0")
status4 <- status4 %>% relocate(study_id)
status4
## build status5 ----
# build status5 table for 5-arm Upa for UC
# Gastroenterology 2020;
# Sandborn, Higgins, et al.
# https://www.gastrojournal.org/article/S0016-5085(20)30241-9/fulltext
#
status5 <- tibble(randomized = c(rep("yes", 250),
rep(NA, 196)),
excluded_reason = c(rep(NA, 250),
rep("Did not meet inclusion criteria", 172),
rep("Withdrew consent", 17),
rep("Lost to follow up", 2),
rep("Other reasons", 5)),
arm = c(rep("Placebo", 46),
rep("Upa 7.5 mg QD", 47),
rep("Upa 15 mg QD", 49),
rep("Upa 30 mg QD", 52),
rep("Upa 45 mg QD", 56),
rep(NA, 196)),
received_int = c(rep("yes", 250),
rep("yes", 196)),
dnr_int_reason = c(rep(NA, 250),
rep(NA, 196)),
completed = c(rep(NA, 5),
rep("yes", 41),
rep(NA, 2),
rep("yes", 45),
rep(NA, 4),
rep("yes", 45),
rep(NA, 6),
rep("yes", 46),
rep(NA, 6),
rep("yes", 50),
rep(NA, 196)),
discont_reason = c(rep("Adverse Event", 3),
rep("Loss of Effect", 2),
rep(NA, 41),
rep("Adverse Event", 1),
rep("Loss of Effect", 1),
rep(NA, 45),
rep("Adverse Event", 2),
rep("Loss of Effect", 1),
rep("Other", 1),
rep(NA, 45),
rep("Adverse Event", 4),
rep("Loss of Effect", 1),
rep("Other", 1),
rep(NA, 46),
rep("Adverse Event", 4),
rep("Loss of Effect", 2),
rep(NA, 50),
rep(NA, 196)),
analyzed = c(rep("yes", 250),
rep(NA, 196)),
not_analyzed_reason = c(rep(NA, 250),
rep(NA, 196)))
# now shuffle rows
set.seed(42)
rows <- sample(nrow(status5))
status5 <- status5[rows, ]
# now add study_id, formatted as "000X"
status5$study_id <- str_pad(1L:446L, width = 6,
side = "left", pad = "0")
status5 <- status5 %>% relocate(study_id)
status5
## build status8 ----
# Now an 8-arm RCT to enhance influenza vaccination uptake
# published in Social Science & Medicine 2017
# https://www.sciencedirect.com/science/article/pii/S0277953617301922
#
# build status8 table for 8-arm influenza uptake
status8 <- tibble(randomized = rep("Yes", 13806),
excluded_reason = rep(NA, 13806),
arm = c(rep("Control Group 1\n(no contact)", 1727),
rep("Control Group 2\n(demographics)", 1699),
rep("Intention,\nAttitude", 1790),
rep("Intention,\nAttitude +\nSticky Note", 1655),
rep("Anticipated\nRegret,\nIntention,\nAttitude", 1763),
rep("Anticipated\nRegret,\nIntention,\nAttitude +\nSticky Note", 1751),
rep("Benificence,\nIntention,\nAttitude", 1743),
rep("Benificence,\nIntention,\nAttitude +\nSticky Note", 1678)),
received_int = c(rep("Yes", 1727),
rep("Yes", 1699),
rep("Yes", 1790),
rep("Yes",, 1655),
rep("Yes", 1763),
rep("Yes", 1751),
rep("Yes", 1743),
rep("Yes", 1678)),
dnr_int_reason = c(rep(NA, 13806)),
completed = c(rep(NA, 1727),
rep(NA, 999),
rep("Yes", 699),
rep(NA, 1080),
rep("Yes", 711),
rep(NA, 904),
rep("Yes", 751),
rep(NA, 1014),
rep("Yes", 748),
rep(NA, 991),
rep("Yes", 761),
rep(NA, 1054),
rep("Yes", 688),
rep(NA, 942),
rep("Yes", 737)),
discont_reason = c(rep("Lost To Follow Up", 1727),
rep("Lost To Follow Up", 999),
rep(NA, 699),
rep("Lost To Follow Up", 1080),
rep(NA, 711),
rep("Lost To Follow Up", 904),
rep(NA, 751),
rep("Lost To Follow Up", 1014),
rep(NA, 748),
rep("Lost To Follow Up", 991),
rep(NA, 761),
rep("Lost To Follow Up", 1054),
rep(NA, 688),
rep("Lost To Follow Up", 942),
rep(NA, 737)),
analyzed = c(rep("Yes", 1727),
rep("Yes", 999),
rep("Yes", 699),
rep("Yes", 1080),
rep("Yes", 711),
rep("Yes", 904),
rep("Yes", 751),
rep("Yes", 1014),
rep("Yes", 748),
rep("Yes", 991),
rep("Yes", 761),
rep("Yes", 1054),
rep("Yes", 688),
rep("Yes", 942),
rep("Yes", 737)),
not_an_reason = c(rep(NA, 1727),
rep(NA, 999),
rep(NA, 699),
rep(NA, 1080),
rep(NA, 711),
rep(NA, 904),
rep(NA, 751),
rep(NA, 1014),
rep(NA, 748),
rep(NA, 991),
rep(NA, 761),
rep(NA, 1054),
rep(NA, 688),
rep(NA, 942),
rep(NA, 737)))
# now shuffle rows
set.seed(42)
rows <- sample(nrow(status8))
status8 <- status8[rows, ]
# now add study_id, formatted as "000X"
# range up to full number randomized
# pick a width to offer at least one leading zero
status8$study_id <- str_pad(1L:13806L, width = 7,
side = "left", pad = "0")
status8 <- status8 %>% relocate(study_id)
status8