Skip to content

Commit 93f89c3

Browse files
ayogasekaramgithub-actions[bot]edelarua
authored
update fda table 2,3,4,6,7, and LBT01 to pharmaverse data (#320)
* update fda table 2,3,4,6,7, and LBT01 to pharmaverse data * [skip style] [skip vbump] Restyle files * update datasets for table 17, 18 * update datasets and result screenshot for tables 29-51 * [skip style] [skip vbump] Restyle files * filter data to reduce table size * [skip style] [skip vbump] Restyle files * Fix stalled checks * update template sorting * revert table 50 for docs check --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Emily de la Rua <emily.de_la_rua@contractors.roche.com>
1 parent a41a1da commit 93f89c3

38 files changed

Lines changed: 208 additions & 192 deletions

File tree

quarto/catalog/fda-table_02/index.qmd

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,19 @@ knitr::include_graphics("result.png")
1818
library(dplyr)
1919
library(gtsummary)
2020
21-
adsl <- random.cdisc.data::cadsl |>
22-
mutate(
23-
AGEGR1 = factor(
24-
case_when(
25-
AGE >= 17 & AGE < 65 ~ ">=17 to <65",
26-
AGE >= 65 & AGE < 75 ~ "65-74",
27-
AGE >= 75 ~ ">=75"
28-
),
29-
levels = c(">=17 to <65", "65-74", ">=75")
30-
)
21+
adsl <- pharmaverseadam::adsl |>
22+
# removing screen failure observations
23+
filter(TRT01A != "Screen Failure") |>
24+
# Adding a numeric biomarker (weight)
25+
left_join(
26+
pharmaverseadam::advs |>
27+
filter(VSTESTCD == "WEIGHT", VISIT == "BASELINE") |>
28+
select(USUBJID, WEIGHTBL = AVAL),
29+
by = "USUBJID",
30+
relationship = "one-to-one"
3131
)
3232
33+
3334
# Pre-processing --------------------------------------------
3435
# Filter for the safety population, x
3536
data <- adsl |>
@@ -42,7 +43,7 @@ data <- adsl |>
4243
tbl <- data |>
4344
tbl_summary(
4445
by = "TRT01A",
45-
include = c("SEX", "AGE", "AGEGR1", "ETHNIC", "RACE", "BMRKR1", "BMRKR2"),
46+
include = c("SEX", "AGE", "AGEGR1", "ETHNIC", "RACE"),
4647
type = all_continuous() ~ "continuous2", # arranges statistics into multiple lines
4748
statistic = list(
4849
all_continuous() ~ c(
-52.2 KB
Loading

quarto/catalog/fda-table_03/index.qmd

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -19,64 +19,37 @@ library(dplyr)
1919
library(cards)
2020
library(gtsummary)
2121
22-
adsl <- random.cdisc.data::cadsl
22+
adsl <- pharmaverseadam::adsl
2323
2424
set.seed(1)
25-
adsl$RANDDT[sample(seq_len(nrow(adsl)), 100)] <- NA
2625
scrnfail_reas_lvls <- c(
2726
"Inclusion/exclusion criteria not met", "Subject noncompliance", "Consent withdrawn", "Other"
2827
)
2928
data <- adsl |>
3029
mutate(
3130
ENRLDT = RANDDT,
31+
ENRLFL = !is.na(ENRLDT),
32+
RANDFL = !is.na(RANDDT),
3233
SCRNFL = TRUE,
33-
SCRNFRS = factor(sample(scrnfail_reas_lvls, size = nrow(adsl), replace = TRUE),
34+
SCRNFRS = NA_character_
35+
) |>
36+
mutate( # set screen failure reasons for relevant observations.
37+
SCRNFRS = factor(
38+
replace(
39+
SCRNFRS,
40+
TRT01A == "Screen Failure",
41+
sample(scrnfail_reas_lvls, size = sum(TRT01A == "Screen Failure"), replace = TRUE)
42+
),
3443
levels = scrnfail_reas_lvls
35-
),
36-
ENRLFL = !is.na(ENRLDT),
37-
RANDFL = !is.na(RANDDT)
38-
)
39-
data$SCRNFRS[data$SCRNFL == "N" | !is.na(data$ENRLDT)] <- NA
40-
```
41-
42-
## Build ARD
43-
44-
```{r ard, message=FALSE, warning=FALSE, results='hide'}
45-
ard <- data |>
46-
ard_stack(
47-
ard_tabulate_value(
48-
variables = SCRNFL,
49-
value = list(SCRNFL = TRUE),
50-
statistic = everything() ~ c("n")
51-
),
52-
ard_tabulate(
53-
variables = SCRNFRS,
54-
statistic = everything() ~ c("n", "p"),
55-
denominator = data
56-
),
57-
ard_tabulate_value(
58-
variables = c(ENRLFL, RANDFL),
59-
value = list(ENRLFL = TRUE, RANDFL = TRUE),
60-
statistic = everything() ~ c("n", "p"),
61-
denominator = data
6244
)
6345
)
64-
65-
ard
66-
```
67-
68-
```{r, echo=FALSE}
69-
# Print ARD
70-
withr::local_options(width = 9999)
71-
print(ard, columns = "all", n = 40)
7246
```
7347

7448
## Build Table
7549

7650
```{r tbl, message=FALSE, warning=FALSE, results='hide'}
7751
tbl_scrn <- tbl_summary(
7852
data = data,
79-
by = TRT01A,
8053
include = "SCRNFL",
8154
missing = "no",
8255
label = ~"Subjects screened"
@@ -86,7 +59,6 @@ tbl_scrnfrs <- tbl_hierarchical(
8659
data = data,
8760
denominator = adsl,
8861
id = USUBJID,
89-
by = TRT01A,
9062
variables = "SCRNFRS",
9163
label = list(..ard_hierarchical_overall.. = "Screening failures"),
9264
overall_row = TRUE
@@ -96,7 +68,6 @@ tbl_scrnfrs <- tbl_hierarchical(
9668
9769
tbl_enrl_rand <- tbl_summary(
9870
data = data,
99-
by = TRT01A,
10071
include = c("ENRLFL", "RANDFL"),
10172
missing = "no",
10273
label = list(ENRLFL = "Subjects enrolled", RANDFL = "Subjects randomized")
@@ -116,4 +87,36 @@ gt::gtsave(as_gt(tbl), filename = "result.png")
11687

11788
```{r img, echo=FALSE, fig.align='center', out.width='60%'}
11889
```
90+
91+
## Build ARD
92+
93+
```{r ard, message=FALSE, warning=FALSE, results='hide'}
94+
ard <- data |>
95+
ard_stack(
96+
ard_tabulate_value(
97+
variables = SCRNFL,
98+
value = list(SCRNFL = TRUE),
99+
statistic = everything() ~ c("n")
100+
),
101+
ard_tabulate(
102+
variables = SCRNFRS,
103+
statistic = everything() ~ c("n", "p"),
104+
denominator = data
105+
),
106+
ard_tabulate_value(
107+
variables = c(ENRLFL, RANDFL),
108+
value = list(ENRLFL = TRUE, RANDFL = TRUE),
109+
statistic = everything() ~ c("n", "p"),
110+
denominator = data
111+
)
112+
)
113+
114+
ard
115+
```
116+
117+
```{r, echo=FALSE}
118+
# Print ARD
119+
withr::local_options(width = 9999)
120+
print(ard, columns = "all", n = 40)
121+
```
119122
:::
18.3 KB
Loading

quarto/catalog/fda-table_04/index.qmd

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,19 @@ knitr::include_graphics("result.png")
1818
library(dplyr)
1919
library(gtsummary)
2020
21-
adsl <- random.cdisc.data::cadsl
21+
adsl <- pharmaverseadam::adsl |>
22+
filter(TRT01A != "Screen Failure") # Remove screen failure observations
2223
2324
# Pre-processing --------------------------------------------
2425
pop_vars <- c("rand_fl", "ITTFL", "SAFFL", "prot_fl")
2526
lbl_pop_vars <- c("Subjects randomized", "ITT population", "Safety population", "Per-protocol population")
2627
2728
data <- adsl |>
2829
mutate(
29-
across(all_of(c("ITTFL", "SAFFL")), ~ . == "Y"),
30+
across(all_of("SAFFL"), ~ . == "Y"),
31+
ITTFL = !is.na(RANDDT),
3032
rand_fl = !is.na(RANDDT),
31-
prot_fl = is.na(DCSREAS)
33+
prot_fl = EOSSTT == "COMPLETED"
3234
)
3335
```
3436

32.1 KB
Loading

quarto/catalog/fda-table_06/index.qmd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ library(dplyr)
1919
library(cards)
2020
library(gtsummary)
2121
22-
adsl <- pharmaverseadam::adsl
22+
adsl <- pharmaverseadam::adsl |>
23+
filter(TRT01A != "Screen Failure") # Remove screening failure observations
2324
2425
# Pre-processing --------------------------------------------
2526
data <- adsl |>
@@ -52,7 +53,7 @@ ard <- data |>
5253
.by = TRT01A,
5354
5455
# Analysis of treatment duration ----------------------
55-
ard_continuous(
56+
ard_summary(
5657
variables = TRTDUR,
5758
statistic = everything() ~ continuous_summary_fns(
5859
# Specify which default statistics to include
45.8 KB
Loading

quarto/catalog/fda-table_07/index.qmd

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,26 @@ knitr::include_graphics("result.png")
1818
library(gtsummary)
1919
library(dplyr)
2020
21-
adsl <- random.cdisc.data::cadsl
22-
adae <- random.cdisc.data::cadae
21+
adsl <- pharmaverseadam::adsl |>
22+
filter(TRT01A != "Screen Failure")
23+
24+
adae <- pharmaverseadam::adae
2325
2426
# Use safety population only
2527
adsl <- adsl |>
2628
filter(SAFFL == "Y")
2729
2830
data <- adae |>
2931
filter(SAFFL == "Y")
30-
```
31-
3232
33+
set.seed(1)
34+
# this data set doesn't have treatment action recorded. We can generate a variable for demonstration.
35+
aeacn_levels <- c("DRUG INTERRUPTED", "DOSE REDUCED", "DOSE RATE REDUCED", "DOSE INCREASED")
36+
data <- data |>
37+
mutate(AEACN = factor(sample(aeacn_levels, size = nrow(data), replace = TRUE),
38+
levels = aeacn_levels
39+
))
40+
```
3341

3442
## Build Table
3543

@@ -41,9 +49,7 @@ sae_vars <- list(
4149
"Death" = "AESDTH",
4250
"Life-threatening" = "AESLIFE",
4351
"Initial or prolonged hospitalization" = "AESHOSP",
44-
"Disability or permanent damage" = "AESDISAB",
45-
"Congenital anomaly or birth defect" = "AESCONG",
46-
"Other" = "AESMIE"
52+
"Disability or permanent damage" = "AESDISAB"
4753
)
4854
4955
# Summarize SAEs per category
@@ -69,24 +75,24 @@ tbl_sae <-
6975
7076
# --- PART 2: Permanent discontinuation
7177
disc_ae <- adae |>
72-
filter(AEACNOTH == "SUBJECT DISCONTINUED FROM STUDY") |>
78+
# filtering for adverse events with a "discontinued" End of Study Status
79+
filter(AESER == "Y" & EOSSTT == "DISCONTINUED") |>
7380
mutate(
7481
# convert label to a more meaningful value
75-
AEACNOTH = "AE leading to permanent discontinuation of treatment"
82+
AEDISC = "AE leading to permanent discontinuation of treatment"
7683
)
7784
7885
tbl_disc_ae <- tbl_hierarchical( # calculate rates
7986
data = disc_ae,
80-
variables = AEACNOTH,
87+
variables = AEDISC,
8188
by = TRT01A,
8289
id = USUBJID,
8390
denominator = adsl,
84-
label = AEACNOTH ~ "Event"
91+
label = AEDISC ~ "Event"
8592
)
8693
8794
# -- PART 3: Dose modification
88-
dose_mod_ae <- adae |>
89-
filter(AEACN %in% c("DRUG INTERRUPTED", "DOSE REDUCED", "DOSE RATE REDUCED", "DOSE INCREASED")) |>
95+
dose_mod_ae <- data |>
9096
mutate(
9197
AEACN = case_when( # convert to meaningful labels
9298
AEACN == "DRUG INTERRUPTED" ~ "AE leading to interruption of study drug",
38.5 KB
Loading

0 commit comments

Comments
 (0)