-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathadam_analysis.html
491 lines (462 loc) · 32.2 KB
/
adam_analysis.html
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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta charset="utf-8">
<meta name="generator" content="quarto-1.2.269">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>ADaM Analysis</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { color: #008000; } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { color: #008000; font-weight: bold; } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<script src="adam_analysis_files/libs/clipboard/clipboard.min.js"></script>
<script src="adam_analysis_files/libs/quarto-html/quarto.js"></script>
<script src="adam_analysis_files/libs/quarto-html/popper.min.js"></script>
<script src="adam_analysis_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="adam_analysis_files/libs/quarto-html/anchor.min.js"></script>
<link href="adam_analysis_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="adam_analysis_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="adam_analysis_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="adam_analysis_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="adam_analysis_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
<script src="adam_analysis_files/libs/quarto-diagram/mermaid.min.js"></script>
<script src="adam_analysis_files/libs/quarto-diagram/mermaid-init.js"></script>
<link href="adam_analysis_files/libs/quarto-diagram/mermaid.css" rel="stylesheet">
</head>
<body class="fullcontent">
<div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
<main class="content" id="quarto-document-content">
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title">ADaM Analysis</h1>
</div>
<div class="quarto-title-meta">
</div>
</header>
<section id="introduction-to-clinical-trial-data" class="level2">
<h2 class="anchored" data-anchor-id="introduction-to-clinical-trial-data">Introduction to Clinical Trial Data</h2>
<div class="cell" data-fig-width="5.5">
<div class="cell-output-display">
<div>
<p>
</p><pre class="mermaid mermaid-js" data-tooltip-selector="#mermaid-tooltip-1">flowchart LR
A(Data Collection\nCRF) --> B(Organize Data\nSDTM )
B --> C(Analysis Data Creation\nADaM)
C --> D(Data Analyzed)
</pre>
<div id="mermaid-tooltip-1" class="mermaidTooltip">
</div>
<p></p>
</div>
</div>
</div>
<p>Clinical trials are conducted to assess the efficacy of various disease interventions. Before and during the study, data is collected pertaining to the study subjects (metadata) and the study outcomes using a <strong>case report form (CRF)</strong>. The <a href="https://www.cdisc.org/standards/foundational/cdash"><strong>Clinical Data Acquisition Standards Harmonization (CDASH) Model</strong></a> provides recommendations for designing CRFs.</p>
<p>Once the data is collected, it is organized into tabular data in accordance to the <a href="https://www.cdisc.org/standards/foundational/sdtm"><strong>Study Data Tabulation Model (SDTM)</strong></a>. SDTM datasets can then be used for the creation of “analysis-ready” <a href="https://www.cdisc.org/standards/foundational/adam"><strong>ADaM (Analytical Data Model)</strong></a> datasets. ADaM is one of the required standards for data submission to FDA (U.S.) and PMDA (Japan)<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a>. ADaM datasets typically have a theme that allows for focused analyses including (but not limited to):</p>
<ul>
<li><p><strong>ADSL:</strong> Subject-Level Analysis</p></li>
<li><p><strong>ADAE:</strong> Adverse Events Analysis</p></li>
<li><p><strong>ADVS:</strong> Vital Signs Analysis</p></li>
<li><p><strong>ADTEE:</strong> Time to Event Analysis</p></li>
<li><p><strong>ADCM:</strong> Concomitant Medication Analysis</p></li>
<li><p><strong>ADLB:</strong> Laboratory Analysis</p></li>
</ul>
<div class="callout-note callout callout-style-default callout-captioned">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-caption-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>The data standards and guidelines described above for CDASH, SDTM, and ADaM are set forth by the <a href="https://www.cdisc.org/"><strong>Clinical Data Interchange Consortium (CDISC)</strong></a>.</p>
</div>
</div>
<div class="callout-important callout callout-style-default callout-captioned">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-caption-container flex-fill">
Important
</div>
</div>
<div class="callout-body-container callout-body">
<p>We will use a publicly available ADSL dataset from the <a href="https://github.com/cdisc-org/sdtm-adam-pilot-project/tree/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/analysis/adam/datasets">CDISC pilot study</a>. This is <strong>test</strong> data and has been appropriately cleansed and de-identified for informational and research purposes.</p>
</div>
</div>
</section>
<section id="using-a-validated-package-repository" class="level2">
<h2 class="anchored" data-anchor-id="using-a-validated-package-repository">Using a Validated Package Repository</h2>
<div class="columns">
<div class="column" style="width:70%;">
<p>For some data science teams, especially those working with clinical data and submitting results to regulatory agencies, the development environment must be carefully designed and tightly regulated to ensure reproducibility. This is often referred to as a <strong>validated</strong> <strong>environment</strong>. Within a validated environment, open-source packages are usually vetted to ensure they meet specific requirements before making them available to developers via a <strong>validated package repository</strong>.</p>
<p>With Posit Package Manager, teams can easily create their own custom package repositories, including a validated repository for clinical data analyses. In this example, we will use a <em>validated</em> repository hosted on Posit’s internal Posit Package Manager instance:</p>
</div><div class="column" style="width:30%;">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="images/ppm_r_repos.png" class="img-fluid figure-img" width="164"></p>
</figure>
</div>
</div>
</div>
<p>To install an R package from a specific R repository on Posit Package Manager, we can modify the <code>repos</code> argument from within the <code>options()</code> function:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">options</span>(<span class="at">repos =</span> <span class="fu">c</span>(<span class="at">REPO_NAME =</span> <span class="st">"url-to-your-validated-R-repo"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>If you restart your R session, you’ll need to re-enter the above code to set your R repository. To maintain this configuration across all R sessions, you can add this command to your <code>.Rprofile</code> R startup file. If you’re using Posit Workbench, your administrator can set this configuration server-wide by adding this line to the <code>.Rprofile.site</code> file.</p>
</section>
<section id="read-and-explore-adsl-data-using-r" class="level2">
<h2 class="anchored" data-anchor-id="read-and-explore-adsl-data-using-r">Read and Explore ADSL Data using R</h2>
<p>On the CDISC GitHub page, the ADSL data is stored as a <code>.xpt</code> file that is created using SAS. Fortunately, we can still read this data into R using the power of open-source data science! Here we’ll use the <a href="https://haven.tidyverse.org/index.html"><code>haven</code></a> package from R to read in the <code>adsl.xpt</code> and save it to the variable <code>adsl</code>.</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(haven) <span class="co"># For reading SAS datasets</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(dplyr) <span class="co"># For data manipulation</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Read in the ADSL dataset</span></span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a>adsl <span class="ot"><-</span> <span class="fu">read_xpt</span>(<span class="at">file =</span> <span class="st">"adsl.xpt"</span>, <span class="cn">NULL</span>)</span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a><span class="co"># Take a glimpse of the data to see what it looks like</span></span>
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a><span class="fu">glimpse</span>(adsl)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>Rows: 254
Columns: 48
$ STUDYID <chr> "CDISCPILOT01", "CDISCPILOT01", "CDISCPILOT01", "CDISCPILOT01…
$ USUBJID <chr> "01-701-1015", "01-701-1023", "01-701-1028", "01-701-1033", "…
$ SUBJID <chr> "1015", "1023", "1028", "1033", "1034", "1047", "1097", "1111…
$ SITEID <chr> "701", "701", "701", "701", "701", "701", "701", "701", "701"…
$ SITEGR1 <chr> "701", "701", "701", "701", "701", "701", "701", "701", "701"…
$ ARM <chr> "Placebo", "Placebo", "Xanomeline High Dose", "Xanomeline Low…
$ TRT01P <chr> "Placebo", "Placebo", "Xanomeline High Dose", "Xanomeline Low…
$ TRT01PN <dbl> 0, 0, 81, 54, 81, 0, 54, 54, 54, 0, 0, 81, 81, 81, 0, 81, 81,…
$ TRT01A <chr> "Placebo", "Placebo", "Xanomeline High Dose", "Xanomeline Low…
$ TRT01AN <dbl> 0, 0, 81, 54, 81, 0, 54, 54, 54, 0, 0, 81, 81, 81, 0, 81, 81,…
$ TRTSDT <date> 2014-01-02, 2012-08-05, 2013-07-19, 2014-03-18, 2014-07-01, …
$ TRTEDT <date> 2014-07-02, 2012-09-01, 2014-01-14, 2014-03-31, 2014-12-30, …
$ TRTDUR <dbl> 182, 28, 180, 14, 183, 26, 190, 10, 55, 182, 183, 183, 38, 18…
$ AVGDD <dbl> 0.0, 0.0, 77.7, 54.0, 76.9, 0.0, 54.0, 54.0, 54.0, 0.0, 0.0, …
$ CUMDOSE <dbl> 0, 0, 13986, 756, 14067, 0, 10260, 540, 2970, 0, 0, 14121, 26…
$ AGE <dbl> 63, 64, 71, 74, 77, 85, 68, 81, 84, 52, 84, 81, 75, 57, 79, 5…
$ AGEGR1 <chr> "<65", "<65", "65-80", "65-80", "65-80", ">80", "65-80", ">80…
$ AGEGR1N <dbl> 1, 1, 2, 2, 2, 3, 2, 3, 3, 1, 3, 3, 2, 1, 2, 1, 2, 2, 2, 3, 2…
$ AGEU <chr> "YEARS", "YEARS", "YEARS", "YEARS", "YEARS", "YEARS", "YEARS"…
$ RACE <chr> "WHITE", "WHITE", "WHITE", "WHITE", "WHITE", "WHITE", "WHITE"…
$ RACEN <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1…
$ SEX <chr> "F", "M", "M", "M", "F", "F", "M", "F", "M", "M", "M", "F", "…
$ ETHNIC <chr> "HISPANIC OR LATINO", "HISPANIC OR LATINO", "NOT HISPANIC OR …
$ SAFFL <chr> "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "…
$ ITTFL <chr> "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "…
$ EFFFL <chr> "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "…
$ COMP8FL <chr> "Y", "N", "Y", "N", "Y", "N", "Y", "N", "Y", "Y", "Y", "Y", "…
$ COMP16FL <chr> "Y", "N", "Y", "N", "Y", "N", "Y", "N", "N", "Y", "Y", "Y", "…
$ COMP24FL <chr> "Y", "N", "Y", "N", "Y", "N", "Y", "N", "N", "Y", "Y", "Y", "…
$ DISCONFL <chr> "", "Y", "", "Y", "", "Y", "", "Y", "Y", "", "", "", "Y", "",…
$ DSRAEFL <chr> "", "Y", "", "", "", "Y", "", "Y", "Y", "", "", "", "Y", "", …
$ DTHFL <chr> "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "…
$ BMIBL <dbl> 25.1, 30.4, 31.4, 28.8, 26.1, 30.4, 27.3, 23.9, 23.9, 21.9, 2…
$ BMIBLGR1 <chr> "25-<30", ">=30", ">=30", "25-<30", "25-<30", ">=30", "25-<30…
$ HEIGHTBL <dbl> 147.3, 162.6, 177.8, 175.3, 154.9, 148.6, 168.9, 158.2, 181.6…
$ WEIGHTBL <dbl> 54.4, 80.3, 99.3, 88.5, 62.6, 67.1, 78.0, 59.9, 78.9, 71.2, 7…
$ EDUCLVL <dbl> 16, 14, 16, 12, 9, 8, 18, 22, 12, 14, 12, 10, 16, 15, 6, 16, …
$ DISONSDT <date> 2010-04-30, 2006-03-11, 2009-12-16, 2009-08-02, 2011-09-29, …
$ DURDIS <dbl> 43.9, 76.4, 42.8, 55.3, 32.9, 42.0, 99.1, 40.7, 101.9, 44.2, …
$ DURDSGR1 <chr> ">=12", ">=12", ">=12", ">=12", ">=12", ">=12", ">=12", ">=12…
$ VISIT1DT <date> 2013-12-26, 2012-07-22, 2013-07-11, 2014-03-10, 2014-06-24, …
$ RFSTDTC <chr> "2014-01-02", "2012-08-05", "2013-07-19", "2014-03-18", "2014…
$ RFENDTC <chr> "2014-07-02", "2012-09-02", "2014-01-14", "2014-04-14", "2014…
$ VISNUMEN <dbl> 12, 5, 12, 5, 12, 6, 12, 4, 8, 12, 12, 12, 7, 12, 12, 7, 4, 7…
$ RFENDT <date> 2014-07-02, 2012-09-02, 2014-01-14, 2014-04-14, 2014-12-30, …
$ DCDECOD <chr> "COMPLETED", "ADVERSE EVENT", "COMPLETED", "STUDY TERMINATED …
$ DCREASCD <chr> "Completed", "Adverse Event", "Completed", "Sponsor Decision"…
$ MMSETOT <dbl> 23, 23, 23, 23, 21, 23, 10, 23, 20, 20, 19, 21, 22, 21, 10, 1…</code></pre>
</div>
</div>
<p>Below I’ll list some of the columns pertinent to this example workflow:</p>
<ul>
<li><p><strong>SUBJID</strong>: Subject identifier for the study</p></li>
<li><p><strong>AGE</strong>: Age</p></li>
<li><p><strong>BMIBL</strong>: Baseline body mass index (BMI)</p></li>
<li><p><strong>HEIGHTBL</strong>: Baseline height</p></li>
<li><p><strong>SEX</strong>: Sex</p></li>
<li><p><strong>TRT01A</strong>: Treatment group (actual) for period 1. The three treatment groups are Placebo, Xanomeline Low Dose, and Xanomeline high Dose.</p></li>
</ul>
</section>
<section id="explore-the-data-using-shiny" class="level2">
<h2 class="anchored" data-anchor-id="explore-the-data-using-shiny">Explore the Data using Shiny</h2>
<p>While this data is not particularly large, it does contain numerous descriptive columns, and it can be a challenge to create static insights (i.e. plots, tables) to explore them all. For this reason, we will create an interactive web application using the the <a href="https://shiny.rstudio.com/"><code>shiny</code></a> R package, which will allow viewers to explore the data for themselves!</p>
<p>The goal of this application is to explore the subject metadata and compare them between the various treatment arms. Below is the code for the shiny application:</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(shiny) <span class="co"># Web app development</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(haven) <span class="co"># Read in SAS dataset</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(ggplot2) <span class="co"># Data visualization</span></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(scales) <span class="co"># Improve axis labels</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a><span class="co"># Read in Data -------------------------------</span></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a>adsl <span class="ot"><-</span> <span class="fu">read_xpt</span>(<span class="st">"adsl.xpt"</span>)</span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a><span class="co"># User Interface -----------------------------</span></span>
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a>ui <span class="ot"><-</span> <span class="fu">fluidPage</span>(</span>
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">sidebarLayout</span>(</span>
<span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">sidebarPanel</span>(</span>
<span id="cb4-13"><a href="#cb4-13" aria-hidden="true" tabindex="-1"></a> <span class="co"># Drop down select input</span></span>
<span id="cb4-14"><a href="#cb4-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">selectInput</span>(<span class="st">"subject_data"</span>, <span class="st">"Subject Data"</span>, </span>
<span id="cb4-15"><a href="#cb4-15" aria-hidden="true" tabindex="-1"></a> <span class="at">choices =</span> <span class="fu">c</span>(<span class="st">"Age"</span> <span class="ot">=</span> <span class="st">"AGE"</span>,</span>
<span id="cb4-16"><a href="#cb4-16" aria-hidden="true" tabindex="-1"></a> <span class="st">"Baseline BMI"</span> <span class="ot">=</span> <span class="st">"BMIBL"</span>,</span>
<span id="cb4-17"><a href="#cb4-17" aria-hidden="true" tabindex="-1"></a> <span class="st">"Baseline Height"</span> <span class="ot">=</span> <span class="st">"HEIGHTBL"</span>,</span>
<span id="cb4-18"><a href="#cb4-18" aria-hidden="true" tabindex="-1"></a> <span class="st">"Baseline Weight"</span> <span class="ot">=</span> <span class="st">"WEIGHTBL"</span>,</span>
<span id="cb4-19"><a href="#cb4-19" aria-hidden="true" tabindex="-1"></a> <span class="st">"Years of Education"</span> <span class="ot">=</span> <span class="st">"EDUCLVL"</span>))),</span>
<span id="cb4-20"><a href="#cb4-20" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb4-21"><a href="#cb4-21" aria-hidden="true" tabindex="-1"></a> <span class="co"># Main panel (boxplot)</span></span>
<span id="cb4-22"><a href="#cb4-22" aria-hidden="true" tabindex="-1"></a> <span class="fu">mainPanel</span>(<span class="fu">plotOutput</span>(<span class="st">"boxplot"</span>))</span>
<span id="cb4-23"><a href="#cb4-23" aria-hidden="true" tabindex="-1"></a> )</span>
<span id="cb4-24"><a href="#cb4-24" aria-hidden="true" tabindex="-1"></a>)</span>
<span id="cb4-25"><a href="#cb4-25" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-26"><a href="#cb4-26" aria-hidden="true" tabindex="-1"></a><span class="co"># Server Function ---------------------------</span></span>
<span id="cb4-27"><a href="#cb4-27" aria-hidden="true" tabindex="-1"></a>server <span class="ot"><-</span> <span class="cf">function</span>(input, output, session) {</span>
<span id="cb4-28"><a href="#cb4-28" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb4-29"><a href="#cb4-29" aria-hidden="true" tabindex="-1"></a> <span class="co"># Create Plot</span></span>
<span id="cb4-30"><a href="#cb4-30" aria-hidden="true" tabindex="-1"></a> output<span class="sc">$</span>boxplot <span class="ot"><-</span> <span class="fu">renderPlot</span>({</span>
<span id="cb4-31"><a href="#cb4-31" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="at">data =</span> adsl, <span class="fu">aes</span>(<span class="at">x =</span> TRT01A, </span>
<span id="cb4-32"><a href="#cb4-32" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> .data[[input<span class="sc">$</span>subject_data]], </span>
<span id="cb4-33"><a href="#cb4-33" aria-hidden="true" tabindex="-1"></a> <span class="at">fill =</span> TRT01A)) <span class="sc">+</span></span>
<span id="cb4-34"><a href="#cb4-34" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_boxplot</span>() <span class="sc">+</span></span>
<span id="cb4-35"><a href="#cb4-35" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_jitter</span>(<span class="at">width =</span> <span class="fl">0.3</span>, <span class="at">alpha =</span> <span class="fl">0.4</span>) <span class="sc">+</span></span>
<span id="cb4-36"><a href="#cb4-36" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme_minimal</span>() <span class="sc">+</span></span>
<span id="cb4-37"><a href="#cb4-37" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme</span>(<span class="at">legend.position =</span> <span class="st">"none"</span>,</span>
<span id="cb4-38"><a href="#cb4-38" aria-hidden="true" tabindex="-1"></a> <span class="at">text =</span> <span class="fu">element_text</span>(<span class="at">size =</span> <span class="dv">15</span>)) <span class="sc">+</span></span>
<span id="cb4-39"><a href="#cb4-39" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span>
<span id="cb4-40"><a href="#cb4-40" aria-hidden="true" tabindex="-1"></a> <span class="at">title =</span> <span class="st">"ADSL Data"</span>,</span>
<span id="cb4-41"><a href="#cb4-41" aria-hidden="true" tabindex="-1"></a> <span class="at">subtitle =</span> <span class="st">"Comparing Treatment Groups"</span>,</span>
<span id="cb4-42"><a href="#cb4-42" aria-hidden="true" tabindex="-1"></a> <span class="at">x =</span> <span class="st">""</span>,</span>
<span id="cb4-43"><a href="#cb4-43" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> <span class="fu">attributes</span>(adsl[[input<span class="sc">$</span>subject_data]])</span>
<span id="cb4-44"><a href="#cb4-44" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span>
<span id="cb4-45"><a href="#cb4-45" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_x_discrete</span>(<span class="at">labels =</span> <span class="fu">label_wrap</span>(<span class="dv">10</span>))</span>
<span id="cb4-46"><a href="#cb4-46" aria-hidden="true" tabindex="-1"></a> }, <span class="at">res =</span> <span class="dv">100</span>)</span>
<span id="cb4-47"><a href="#cb4-47" aria-hidden="true" tabindex="-1"></a>}</span>
<span id="cb4-48"><a href="#cb4-48" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-49"><a href="#cb4-49" aria-hidden="true" tabindex="-1"></a><span class="fu">shinyApp</span>(ui, server)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="make-your-project-reproducible-using-renv" class="level2">
<h2 class="anchored" data-anchor-id="make-your-project-reproducible-using-renv">Make your Project Reproducible using <code>renv</code></h2>
<p>If someone else wanted to reproducible your work, there is certain information that would be helpful to include in your R project, including:</p>
<ul>
<li><p>Which R version was used?</p></li>
<li><p>What packages were used?</p></li>
<li><p>What package versions were used?</p></li>
<li><p>Where were the packages installed from (repositories)?</p></li>
</ul>
<p>Enter <a href="https://rstudio.github.io/renv/index.html"><code>renv</code></a>! This is an open-source R package that can easily create a recording of our project’s R and package dependencies. In order to leverage <code>renv</code>, you need to be within an <a href="https://support.posit.co/hc/en-us/articles/200526207-Using-RStudio-Projects">RStudio Project</a>. You can either <a href="https://docs.posit.co/ide/user/ide/guide/environments/r/renv.html#new-project-use-renv-with-this-project">initialize a new project out of the gate by clicking the box “Use renv with this project.”</a> Or, from within a current RStudio Project, you can run the <code>init()</code> function from within the <code>renv</code> package. This will create a <a href="https://rstudio.github.io/renv/reference/lockfiles.html?q"><code>renv.lock</code></a> file which will keep track of our project’s R and package dependencies! This file can also be shared with others in order to reproduce the project’s package environment.</p>
<p>As your project’s package environment changes (install/update/delete packages), you can update the <code>renv.lock</code> file by running the <code>snapshot()</code> function from within <code>renv</code>.</p>
</section>
<div id="quarto-appendix" class="default"><section id="footnotes" class="footnotes footnotes-end-of-document" role="doc-endnotes"><h2 class="anchored quarto-appendix-heading">Footnotes</h2>
<ol>
<li id="fn1"><p>Source: https://www.cdisc.org/standards/foundational/adam<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
</ol>
</section></div></main>
<!-- /main column -->
<script id="quarto-html-after-body" type="application/javascript">
window.document.addEventListener("DOMContentLoaded", function (event) {
const toggleBodyColorMode = (bsSheetEl) => {
const mode = bsSheetEl.getAttribute("data-mode");
const bodyEl = window.document.querySelector("body");
if (mode === "dark") {
bodyEl.classList.add("quarto-dark");
bodyEl.classList.remove("quarto-light");
} else {
bodyEl.classList.add("quarto-light");
bodyEl.classList.remove("quarto-dark");
}
}
const toggleBodyColorPrimary = () => {
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
if (bsSheetEl) {
toggleBodyColorMode(bsSheetEl);
}
}
toggleBodyColorPrimary();
const icon = "";
const anchorJS = new window.AnchorJS();
anchorJS.options = {
placement: 'right',
icon: icon
};
anchorJS.add('.anchored');
const clipboard = new window.ClipboardJS('.code-copy-button', {
target: function(trigger) {
return trigger.previousElementSibling;
}
});
clipboard.on('success', function(e) {
// button target
const button = e.trigger;
// don't keep focus
button.blur();
// flash "checked"
button.classList.add('code-copy-button-checked');
var currentTitle = button.getAttribute("title");
button.setAttribute("title", "Copied!");
let tooltip;
if (window.bootstrap) {
button.setAttribute("data-bs-toggle", "tooltip");
button.setAttribute("data-bs-placement", "left");
button.setAttribute("data-bs-title", "Copied!");
tooltip = new bootstrap.Tooltip(button,
{ trigger: "manual",
customClass: "code-copy-button-tooltip",
offset: [0, -8]});
tooltip.show();
}
setTimeout(function() {
if (tooltip) {
tooltip.hide();
button.removeAttribute("data-bs-title");
button.removeAttribute("data-bs-toggle");
button.removeAttribute("data-bs-placement");
}
button.setAttribute("title", currentTitle);
button.classList.remove('code-copy-button-checked');
}, 1000);
// clear code selection
e.clearSelection();
});
function tippyHover(el, contentFn) {
const config = {
allowHTML: true,
content: contentFn,
maxWidth: 500,
delay: 100,
arrow: false,
appendTo: function(el) {
return el.parentElement;
},
interactive: true,
interactiveBorder: 10,
theme: 'quarto',
placement: 'bottom-start'
};
window.tippy(el, config);
}
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
for (var i=0; i<noterefs.length; i++) {
const ref = noterefs[i];
tippyHover(ref, function() {
// use id or data attribute instead here
let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
try { href = new URL(href).hash; } catch {}
const id = href.replace(/^#\/?/, "");
const note = window.document.getElementById(id);
return note.innerHTML;
});
}
const findCites = (el) => {
const parentEl = el.parentElement;
if (parentEl) {
const cites = parentEl.dataset.cites;
if (cites) {
return {
el,
cites: cites.split(' ')
};
} else {
return findCites(el.parentElement)
}
} else {
return undefined;
}
};
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
for (var i=0; i<bibliorefs.length; i++) {
const ref = bibliorefs[i];
const citeInfo = findCites(ref);
if (citeInfo) {
tippyHover(citeInfo.el, function() {
var popup = window.document.createElement('div');
citeInfo.cites.forEach(function(cite) {
var citeDiv = window.document.createElement('div');
citeDiv.classList.add('hanging-indent');
citeDiv.classList.add('csl-entry');
var biblioDiv = window.document.getElementById('ref-' + cite);
if (biblioDiv) {
citeDiv.innerHTML = biblioDiv.innerHTML;
}
popup.appendChild(citeDiv);
});
return popup.innerHTML;
});
}
}
});
</script>
</div> <!-- /content -->
</body></html>