Skip to content

Commit 694a207

Browse files
committed
rerun at 2022/02/01
1 parent a46e694 commit 694a207

10 files changed

+74
-71
lines changed

output/tlf-demographic.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ MMSE Total
3636
------------------------------------------------------------------------------------------------
3737

3838
Program: tlf_demographic.Rmd
39-
2022-01-19 01:08:16
39+
2022-02-01 17:21:29
4040

output/tlf-kmplot.pdf

-1 Bytes
Binary file not shown.

output/tlf-primary.rtf

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
\par\ql
5959
{\f1\fs20\i [3] Pairwise comparison with treatment as a categorical variable: p-values without adjustment for multiple comparisons.}
6060
\par\ql\tx7245\tqr\tx12960
61-
{\f1\fs20\i Source: <run interactively>}\pmartabqr
62-
{\f1\fs20\i 21:47 Monday, January 31, 2022}\par
61+
{\f1\fs20\i }\pmartabqr
62+
{\f1\fs20\i 17:21 Tuesday, February 01, 2022}\par
6363
}
6464
{
6565
\trowd

vignettes/ectd/r0pkg.txt

+9-5
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Package: pilot1wrappers
101101
File: NEWS.md
102102
Format: text
103103
Content:
104-
# pilot1wrappers 0.1.0
104+
# pilot1wrappers 0.1.1
105105

106106
* Address reviewer comments for `tlf-efficacy.Rmd` and `tlf-primary`.
107107
* Change running R version to R4.1.2
@@ -141,8 +141,10 @@ Content:
141141

142142
## FDA Response
143143

144-
- Response to initial submission
145-
+ response letter <
144+
- Initial submission
145+
+ version: [v0.1.0](https://github.com/RConsortium/submissions-pilot1/releases/tag/v0.1.0)
146+
+ [FDA statistical review and evaluation](https://github.com/RConsortium/submissions-pilot1/blob/main/vignettes/fda/fda-response-2021-11-22.pdf)
147+
146148
## Running Environment
147149

148150
The project is developed and tested in the environment below:
@@ -159,6 +161,9 @@ Content:
159161
- [Marwick, B., Boettiger, C., & Mullen, L. (2018). Packaging data analytical work reproducibly using R (and friends). The American Statistician, 72(1), 80-88.](https://peerj.com/preprints/3192/)
160162
- [Wu, P., Palukuru, U. P., Luo, Y., Nepal, S., & Zhang, Y. (2021) Analysis and reporting in regulated clinical trial environment using R. PharmaSUG 2021](https://www.pharmasug.org/proceedings/2021/AD/PharmaSUG-2021-AD-079.pdf)
161163

164+
More details related to organize a clinical project and submission package can be found in Chapter 9-14
165+
of the [R for Clinical Study Reports and Submission](https://r4csr.org/index.html) book.
166+
162167
### R function and Analysis Scripts
163168

164169
In short, the project is organized as an R package.
@@ -214,8 +219,7 @@ Content:
214219
#' @export
215220
#'
216221
efficacy_models <- function(data, var=NULL, wk=NULL) {
217-
218-
222+
219223
# Need to set contrasts to work for Type III SS. See analysis results metadata for
220224
# table 14-3.01. Reference for R here: https://www.r-bloggers.com/anova-%E2%80%93-type-iiiiii-ss-explained/
221225
op <- options(contrasts = c("contr.sum","contr.poly"))

vignettes/ectd/tlf-demographic.r

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
# The path variable needs to be defined by using example code below
55
#
66
# path = list(adam = "path/to/esub/analysis/adam/datasets") # Modify path to the actual location
7-
# path$outtable = path$outgraph = "." # Output saved in current folder
7+
# path$output = "." # Output saved in current folder
88

9-
## ------------------------------------------------------------------------------------------
9+
## ------------------------------------------------------------------------------------------------------------------------------
1010
# Working directory requires write permission
1111
if(file.access(".", 2) != 0){
1212
warning(
@@ -16,7 +16,7 @@ if(file.access(".", 2) != 0){
1616
}
1717

1818

19-
## ----setup, message=FALSE------------------------------------------------------------------
19+
## ----setup, message=FALSE------------------------------------------------------------------------------------------------------
2020
# CRAN package, please using install.packages() to install
2121
library(haven)
2222
library(dplyr)
@@ -26,12 +26,12 @@ library(rtables)
2626
library(pilot1wrappers)
2727

2828

29-
## ------------------------------------------------------------------------------------------
29+
## ------------------------------------------------------------------------------------------------------------------------------
3030
adsl <- read_xpt(file.path(path$adam, "adsl.xpt"))
3131
adsl_labels <- var_labels(adsl)
3232

3333

34-
## ------------------------------------------------------------------------------------------
34+
## ------------------------------------------------------------------------------------------------------------------------------
3535
adsl <- adsl %>%
3636
dplyr::filter(
3737
STUDYID == "CDISCPILOT01",
@@ -44,7 +44,7 @@ adsl <- adsl %>%
4444
)
4545

4646

47-
## ------------------------------------------------------------------------------------------
47+
## ------------------------------------------------------------------------------------------------------------------------------
4848
# Table layout
4949
vars <- c("AGE", "AGEGR1", "RACE", "HEIGHTBL", "WEIGHTBL", "BMIBL", "MMSETOT")
5050
lyt <- basic_table(title = "Protocol: CDISCPILOT01",
@@ -75,7 +75,7 @@ tbl <- build_table(lyt, adsl)
7575
tbl
7676

7777

78-
## ------------------------------------------------------------------------------------------
78+
## ------------------------------------------------------------------------------------------------------------------------------
7979
# Output .out file
8080
tbl %>%
8181
toString() %>%

vignettes/ectd/tlf-efficacy.r

+28-26
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
# The path variable needs to be defined by using example code below
55
#
66
# path = list(adam = "path/to/esub/analysis/adam/datasets") # Modify path to the actual location
7-
# path$outtable = path$outgraph = "." # Output saved in current folder
7+
# path$output = "." # Output saved in current folder
88

9-
10-
## ------------------------------------------------------------------------------------------
9+
## ------------------------------------------------------------------------------------------------------------------------------
1110
# Working directory requires write permission
1211
if(file.access(".", 2) != 0){
1312
warning(
@@ -17,7 +16,7 @@ if(file.access(".", 2) != 0){
1716
}
1817

1918

20-
## ----setup, message=FALSE------------------------------------------------------------------
19+
## ----setup, message=FALSE------------------------------------------------------------------------------------------------------
2120
knitr::opts_chunk$set(echo = TRUE)
2221

2322
# CRAN package, please using install.packages() to install
@@ -30,12 +29,18 @@ library(emmeans)
3029
library(pilot1wrappers)
3130

3231

33-
## ------------------------------------------------------------------------------------------
32+
## ------------------------------------------------------------------------------------------------------------------------------
33+
adsl <- read_xpt(file.path(path$adam, "adsl.xpt"))
3434
adlb <- read_xpt(file.path(path$adam, "adlbc.xpt"))
3535

3636

37-
## ------------------------------------------------------------------------------------------
38-
adlb1 <- subset(adlb, TRTPN %in% c(0, 81) & PARAMCD == "GLUC" & !is.na(AVISITN)) %>%
37+
## ------------------------------------------------------------------------------------------------------------------------------
38+
39+
itt <- adsl[adsl[["ITTFL"]] == "Y", c("STUDYID", "USUBJID")]
40+
41+
adlb1 <- adlb %>%
42+
dplyr::right_join(itt, by = c("STUDYID", "USUBJID")) %>%
43+
subset(TRTPN %in% c(0, 81) & PARAMCD == "GLUC" & !is.na(AVISITN)) %>%
3944
mutate(TRTPN = ifelse(TRTPN == 0, 99, TRTPN)) # change treatment order for pairwise comparison
4045

4146
## Fit data for linear model
@@ -54,7 +59,7 @@ t10 <- adlb1 %>%
5459
)
5560

5661
t11 <- adlb1 %>%
57-
filter(AVISITN == 20) %>%
62+
filter(AVISITN == 20, !is.na(CHG), !is.na(BASE)) %>%
5863
group_by(TRTPN, TRTP) %>%
5964
summarise(
6065
N_20 = n(),
@@ -72,7 +77,7 @@ apr0ancova1 <- merge(t10, t11) %>%
7277
merge(t12) %>%
7378
mutate(emmean_sd = SE * sqrt(df)) %>%
7479
mutate(
75-
Trt = c("Study Drug", "Placebo"),
80+
Trt = c("Xanomeline High Dose", "Placebo"),
7681
N1 = N,
7782
Mean1 = pilot1wrappers::fmt_est(mean_bl, sd_bl),
7883
N2 = N_20,
@@ -86,7 +91,7 @@ apr0ancova1 <- merge(t10, t11) %>%
8691
apr0ancova1
8792

8893

89-
## ------------------------------------------------------------------------------------------
94+
## ------------------------------------------------------------------------------------------------------------------------------
9095
t2 <- data.frame(pairs(t12))
9196

9297
## Treatment Comparison
@@ -96,7 +101,7 @@ apr0ancova2 <- t2 %>%
96101
upper = estimate + 1.96 * SE
97102
) %>%
98103
mutate(
99-
comp = "Study Drug vs. Placebo",
104+
comp = "Xanomeline High Dose vs. Placebo",
100105
mean = pilot1wrappers::fmt_ci(estimate, lower, upper),
101106
p = pilot1wrappers::fmt_pval(p.value)
102107
) %>%
@@ -105,31 +110,31 @@ apr0ancova2 <- t2 %>%
105110
apr0ancova2
106111

107112

108-
## ------------------------------------------------------------------------------------------
113+
## ------------------------------------------------------------------------------------------------------------------------------
109114
### Calculate root mean square and save data in output folder
110115
apr0ancova3 <- data.frame(rmse = paste0(
111116
"Root Mean Squared Error of Change = ",
112-
formatC(sd(gluc_lmfit$residuals), digits = 2, format = "f", flag = "0")
117+
formatC(sqrt(mean((gluc_lmfit$residuals)^2)), digits = 2, format = "f", flag = "0")
113118
))
114119

115120
apr0ancova3
116121

117122

118-
## ------------------------------------------------------------------------------------------
123+
## ------------------------------------------------------------------------------------------------------------------------------
119124
tbl_1 <- apr0ancova1 %>%
120125
rtf_title(
121126
title = "ANCOVA of Change from Baseline at Week 20"
122127
) %>%
123128
rtf_colheader(
124129
colheader = " | Baseline{^a} | Week 20 | Change from Baseline",
125-
col_rel_width = c(3, 4, 4, 9)
130+
col_rel_width = c(4, 3.5, 3.5, 7.5)
126131
) %>%
127132
rtf_colheader(
128133
colheader = "Treatment | N | Mean (SD) | N | Mean (SD) | N | Mean (SD) | LS Mean (95% CI){^b}",
129-
col_rel_width = c(3, 1, 3, 1, 3, 1, 3, 5)
134+
col_rel_width = c(4, 1, 2.5, 1, 2.5, 1, 2.5, 4)
130135
) %>%
131136
rtf_body(
132-
col_rel_width = c(3, 1, 3, 1, 3, 1, 3, 5),
137+
col_rel_width = c(4, 1, 2.5, 1, 2.5, 1, 2.5, 4),
133138
text_justification = c("l", rep("c", 7)),
134139
last_row = FALSE
135140
) %>%
@@ -141,40 +146,37 @@ tbl_1 <- apr0ancova1 %>%
141146
)
142147
) %>%
143148
rtf_source(
144-
source = "Source: [pilot1wrappers: adam-adlbc]",
149+
source = "Source: [pilot1wrappers: adam-adsl; adlbc]",
145150
text_justification = "c"
146151
)
147152

148153

149-
## ------------------------------------------------------------------------------------------
154+
## ------------------------------------------------------------------------------------------------------------------------------
150155
tbl_2 <- apr0ancova2 %>%
151156
rtf_colheader(
152157
colheader = "Pairwise Comparison | Difference in LS Mean (95% CI){^b} | p-Value",
153158
text_justification = c("l", "c", "c"),
154-
col_rel_width = c(8, 7, 5)
159+
col_rel_width = c(7.5, 7, 4)
155160
) %>%
156161
rtf_body(
157-
col_rel_width = c(8, 7, 5),
162+
col_rel_width = c(7.5, 7, 4),
158163
text_justification = c("l", "c", "c"),
159164
last_row = FALSE
160165
)
161166

162167

163-
## ------------------------------------------------------------------------------------------
168+
## ------------------------------------------------------------------------------------------------------------------------------
164169
tbl_3 <- apr0ancova3 %>%
165170
rtf_body(
166171
as_colheader = FALSE,
167172
text_justification = "l"
168173
)
169174

170175

171-
## ------------------------------------------------------------------------------------------
176+
## ------------------------------------------------------------------------------------------------------------------------------
172177
tbl <- list(tbl_1, tbl_2, tbl_3)
173178
tbl %>%
174179
rtf_encode() %>%
175180
write_rtf(file.path(path$output, "tlf-efficacy.rtf"))
176181

177182

178-
## ---- out.width = "100%", out.height = "400px", echo = FALSE, fig.align = "center"---------
179-
knitr::include_graphics("pdf/tlf-efficacy.pdf")
180-

vignettes/ectd/tlf-kmplot.r

+6-12
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
# The path variable needs to be defined by using example code below
55
#
66
# path = list(adam = "path/to/esub/analysis/adam/datasets") # Modify path to the actual location
7-
# path$outtable = path$outgraph = "." # Output saved in current folder
7+
# path$output = "." # Output saved in current folder
88

9-
10-
## ------------------------------------------------------------------------------------------
9+
## ------------------------------------------------------------------------------------------------------------------------------
1110
# Working directory requires write permission
1211
if(file.access(".", 2) != 0){
1312
warning(
@@ -17,7 +16,7 @@ if(file.access(".", 2) != 0){
1716
}
1817

1918

20-
## ----setup, message=FALSE------------------------------------------------------------------
19+
## ----setup, message=FALSE------------------------------------------------------------------------------------------------------
2120
knitr::opts_chunk$set(echo = TRUE)
2221

2322
# CRAN package, please using install.packages() to install
@@ -31,12 +30,12 @@ library(visR)
3130
library(pilot1wrappers)
3231

3332

34-
## ------------------------------------------------------------------------------------------
33+
## ------------------------------------------------------------------------------------------------------------------------------
3534
adsl <- read_xpt(file.path(path$adam, "adsl.xpt"))
3635
adtte <- read_xpt(file.path(path$adam, "adtte.xpt"))
3736

3837

39-
## ------------------------------------------------------------------------------------------
38+
## ------------------------------------------------------------------------------------------------------------------------------
4039
anl <- adsl %>%
4140
dplyr::filter(
4241
SAFFL == "Y",
@@ -54,7 +53,7 @@ anl <- adsl %>%
5453
)
5554

5655

57-
## ------------------------------------------------------------------------------------------
56+
## ------------------------------------------------------------------------------------------------------------------------------
5857
# estimate survival
5958
surv_mod <- visR::estimate_KM(data = anl, strata = "TRT01A")
6059

@@ -101,8 +100,3 @@ KM <- cowplot::plot_grid(
101100

102101
print(KM)
103102
dev.off()
104-
105-
106-
## ---- out.width = "100%", out.height = "400px", echo = FALSE, fig.align = "center"---------
107-
knitr::include_graphics("pdf/tlf-kmplot.pdf")
108-

0 commit comments

Comments
 (0)