Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace usage of scda and scda.2022 with random.cdisc.data #250

Merged
merged 6 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions book/graphs/efficacy/fstg01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ subtitle: Subgroup Analysis of Best Overall Response
```{r setup, message = FALSE}
#| code-fold: show

library(scda)
library(scda.2022)
library(dplyr)
library(tern)
library(nestcolor)

adsl_f <- synthetic_cdisc_dataset("latest", "adsl") %>%
adsl_f <- random.cdisc.data::cadsl %>%
select(STUDYID, USUBJID, ARMCD, ARM, SEX, BMRKR2, STRATA1, STRATA2)

adrs_f <- synthetic_cdisc_dataset("latest", "adrs") %>%
adrs_f <- random.cdisc.data::cadrs %>%
filter(PARAMCD == "INVET") %>%
select(STUDYID, USUBJID, PARAMCD, AVISIT, AVALC)

Expand Down Expand Up @@ -69,7 +67,7 @@ plot <- g_forest(tbl = result)
plot
```

`r webr_code_labels <- c("setup", "plot1")`
`r webr_code_labels <- c("setup", "plot1")`
{{< include ../../_utils/webr.qmd >}}
:::

Expand Down Expand Up @@ -117,7 +115,7 @@ plot <- g_forest(tbl = result)
plot
```

`r webr_code_labels <- c("setup", "plot2")`
`r webr_code_labels <- c("setup", "plot2")`
{{< include ../../_utils/webr.qmd >}}
:::

Expand Down Expand Up @@ -147,7 +145,7 @@ plot <- g_forest(tbl = result)
plot
```

`r webr_code_labels <- c("setup", "plot3")`
`r webr_code_labels <- c("setup", "plot3")`
{{< include ../../_utils/webr.qmd >}}
:::

Expand All @@ -157,7 +155,9 @@ plot
## {{< fa regular file-lines sm fw >}} Preview

<!-- skip strict because of https://github.com/therneau/survival/issues/240 -->

<!-- skip strict because of https://github.com/insightsengineering/tern/issues/1186 -->

```{r plot4, test = list(plot_v4 = "plot"), fig.width = 20, fig.height = 5, opts.label = ifelse(packageVersion("survival") < "3.5-8" || packageVersion("tern") < "0.9.3.9018", "skip_test_strict", "")}
df <- extract_rsp_subgroups(
variables = list(
Expand All @@ -180,7 +180,7 @@ plot <- g_forest(
plot
```

`r webr_code_labels <- c("setup", "plot4")`
`r webr_code_labels <- c("setup", "plot4")`
{{< include ../../_utils/webr.qmd >}}
:::

Expand Down Expand Up @@ -227,7 +227,7 @@ width <- 20
height <- 5
```

`r webr_code_labels <- c("setup", "plot5")`
`r webr_code_labels <- c("setup", "plot5")`
{{< include ../../_utils/webr.qmd >}}
:::

Expand All @@ -244,11 +244,8 @@ library(teal.modules.clinical)
## Data reproducible code
data <- teal_data()
data <- within(data, {
library(scda)
library(scda.2022)

ADSL <- synthetic_cdisc_dataset("latest", "adsl")
ADRS <- synthetic_cdisc_dataset("latest", "adrs")
ADSL <- random.cdisc.data::cadsl
ADRS <- random.cdisc.data::cadrs
})
datanames <- c("ADSL", "ADRS")
datanames(data) <- datanames
Expand Down
18 changes: 7 additions & 11 deletions book/graphs/efficacy/fstg02.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ library(tern)
library(dplyr)
library(forcats)
library(nestcolor)
library(scda)
library(scda.2022)

preprocess_adtte <- function(adtte) {
# Save variable labels before data processing steps.
Expand Down Expand Up @@ -51,7 +49,7 @@ preprocess_adtte <- function(adtte) {
adtte
}

anl <- synthetic_cdisc_dataset("latest", "adtte") %>%
anl <- random.cdisc.data::cadtte %>%
preprocess_adtte()
```

Expand Down Expand Up @@ -82,7 +80,7 @@ plot <- g_forest(tbl = result)
plot
```

`r webr_code_labels <- c("setup", "plot1")`
`r webr_code_labels <- c("setup", "plot1")`
{{< include ../../_utils/webr.qmd >}}
:::

Expand Down Expand Up @@ -124,7 +122,7 @@ plot <- g_forest(tbl = result)
plot
```

`r webr_code_labels <- c("setup", "plot2")`
`r webr_code_labels <- c("setup", "plot2")`
{{< include ../../_utils/webr.qmd >}}
:::

Expand Down Expand Up @@ -155,7 +153,7 @@ plot <- g_forest(tbl = result)
plot
```

`r webr_code_labels <- c("setup", "plot3")`
`r webr_code_labels <- c("setup", "plot3")`
{{< include ../../_utils/webr.qmd >}}
:::

Expand Down Expand Up @@ -195,7 +193,7 @@ height <- 4
plot_v3.width <- 8 # nolint: object_name.
```

`r webr_code_labels <- c("setup", "plot4")`
`r webr_code_labels <- c("setup", "plot4")`
{{< include ../../_utils/webr.qmd >}}
:::

Expand All @@ -212,19 +210,17 @@ library(teal.modules.clinical)
## Data reproducible code
data <- teal_data()
data <- within(data, {
library(scda)
library(scda.2022)
library(dplyr)
library(forcats)

ADSL <- synthetic_cdisc_dataset("latest", "adsl")
ADSL <- random.cdisc.data::cadsl
ADSL <- ADSL %>%
filter(ARM %in% c("B: Placebo", "A: Drug X")) %>%
mutate(ARM = droplevels(fct_relevel(ARM, "B: Placebo"))) %>%
mutate(ARMCD = droplevels(fct_relevel(ARMCD, "ARM B")))
ADSL$RACE <- droplevels(ADSL$RACE)

ADTTE <- synthetic_cdisc_dataset("latest", "adtte")
ADTTE <- random.cdisc.data::cadtte
adtte_labels <- col_labels(ADTTE)

ADTTE <- ADTTE %>%
Expand Down
23 changes: 9 additions & 14 deletions book/graphs/efficacy/kmg01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ subtitle: Kaplan-Meier Plot
#| code-fold: show

library(tern)
library(scda)
library(scda.2022)
library(dplyr)
library(nestcolor)

adtte <- synthetic_cdisc_dataset("latest", "adtte")
adtte <- random.cdisc.data::cadtte
anl <- adtte %>%
dplyr::filter(PARAMCD == "OS") %>%
dplyr::mutate(is_event = CNSR == 0)
Expand All @@ -43,7 +41,7 @@ plot <- g_km(
plot
```

`r webr_code_labels <- c("setup", "plot1")`
`r webr_code_labels <- c("setup", "plot1")`
{{< include ../../_utils/webr.qmd >}}
:::

Expand All @@ -66,7 +64,7 @@ plot <- g_km(
plot
```

`r webr_code_labels <- c("setup", "plot2")`
`r webr_code_labels <- c("setup", "plot2")`
{{< include ../../_utils/webr.qmd >}}
:::

Expand All @@ -86,7 +84,7 @@ plot <- g_km(
plot
```

`r webr_code_labels <- c("setup", "plot3")`
`r webr_code_labels <- c("setup", "plot3")`
{{< include ../../_utils/webr.qmd >}}
:::

Expand All @@ -108,7 +106,7 @@ plot <- g_km(
plot
```

`r webr_code_labels <- c("setup", "plot4")`
`r webr_code_labels <- c("setup", "plot4")`
{{< include ../../_utils/webr.qmd >}}
:::

Expand All @@ -131,7 +129,7 @@ plot <- g_km(
plot
```

`r webr_code_labels <- c("setup", "plot5")`
`r webr_code_labels <- c("setup", "plot5")`
ayogasekaram marked this conversation as resolved.
Show resolved Hide resolved
{{< include ../../_utils/webr.qmd >}}
:::

Expand Down Expand Up @@ -159,7 +157,7 @@ plot <- g_km(
plot
```

`r webr_code_labels <- c("setup", "plot6")`
`r webr_code_labels <- c("setup", "plot6")`
{{< include ../../_utils/webr.qmd >}}
:::

Expand All @@ -183,11 +181,8 @@ library(teal.modules.clinical)
## Data reproducible code
data <- teal_data()
data <- within(data, {
library(scda)
library(scda.2022)

ADSL <- synthetic_cdisc_dataset("latest", "adsl")
ADTTE <- synthetic_cdisc_dataset("latest", "adtte")
ADSL <- random.cdisc.data::cadsl
ADTTE <- random.cdisc.data::cadtte
})
datanames <- c("ADSL", "ADTTE")
datanames(data) <- datanames
Expand Down
12 changes: 4 additions & 8 deletions book/graphs/efficacy/mmrmg01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ Given an MMRM fitted with `s_mmrm`, `g_mmrm_lsmeans` displays for each visit the

library(dplyr)
library(tern.mmrm)
library(scda)
library(scda.2022)
library(nestcolor)

adsl <- synthetic_cdisc_dataset("latest", "adsl")
adqs <- synthetic_cdisc_dataset("latest", "adqs")
adsl <- random.cdisc.data::cadsl
adqs <- random.cdisc.data::cadqs

adqs_f <- adqs %>%
dplyr::filter(PARAMCD == "FKSI-FWB" & !AVISIT %in% c("BASELINE")) %>%
Expand Down Expand Up @@ -124,12 +122,10 @@ library(teal.modules.clinical)
## Data reproducible code
data <- teal_data()
data <- within(data, {
library(scda)
library(scda.2022)
library(dplyr)

ADSL <- synthetic_cdisc_dataset("latest", "adsl")
ADQS <- synthetic_cdisc_dataset("latest", "adqs") %>%
ADSL <- random.cdisc.data::cadsl
ADQS <- random.cdisc.data::cadqs %>%
filter(ABLFL != "Y" & ABLFL2 != "Y") %>%
filter(AVISIT %in% c("WEEK 1 DAY 8", "WEEK 2 DAY 15", "WEEK 3 DAY 22")) %>%
mutate(
Expand Down
6 changes: 2 additions & 4 deletions book/graphs/efficacy/mmrmg02.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ subtitle: Forest Plot for Mixed-Effect Model Repeated Measures
```{r setup, message = FALSE}
#| code-fold: show

library(scda)
library(scda.2022)
library(dplyr)
library(tern.mmrm)
library(nestcolor)

adsl <- synthetic_cdisc_dataset("latest", "adsl")
adqs <- synthetic_cdisc_dataset("latest", "adqs")
adsl <- random.cdisc.data::cadsl
adqs <- random.cdisc.data::cadqs

adqs_f <- adqs %>%
dplyr::filter(PARAMCD == "FKSI-FWB" & !AVISIT %in% c("BASELINE")) %>%
Expand Down
Loading
Loading