Skip to content

Commit

Permalink
replace usage of scda and scda.2022 with random.cdisc.data
Browse files Browse the repository at this point in the history
  • Loading branch information
ayogasekaram committed May 10, 2024
1 parent cd2b70d commit 1fb2d9e
Show file tree
Hide file tree
Showing 138 changed files with 1,100 additions and 1,864 deletions.
4 changes: 2 additions & 2 deletions book/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ execute:
engine: knitr
webr:
channel-type: "post-message"
packages: ["tern", "scda", "scda.2022", "dplyr"]
packages: ["tern", "random.cdisc.data", "dplyr"]
show-startup-message: false
autoload-packages: false

Expand Down Expand Up @@ -118,4 +118,4 @@ website:
profile:
group:
- [stable, development]
default: stable
default: stable
42 changes: 21 additions & 21 deletions book/graphs/efficacy/fstg01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,20 @@ subtitle: Subgroup Analysis of Best Overall Response

{{< include ../../_utils/envir_hook.qmd >}}

:::: {.panel-tabset}
::: panel-tabset
## Data Setup

```{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 All @@ -49,7 +47,9 @@ var_labels(anl_rsp_arms_ab) <- c(anl_labels, is_rsp = "Is Responder")
## {{< 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 plot1, test = list(plot_v1 = "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 @@ -69,8 +69,7 @@ plot <- g_forest(tbl = result)
plot
```

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

## Plot Specifying Class Variables and <br/> Options for the Treatment Variable
Expand All @@ -79,7 +78,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 plot2, test = list(plot_v2 = "plot"), fig.width = 20, fig.height = 5, opts.label = ifelse(packageVersion("survival") < "3.5-8" || packageVersion("tern") < "0.9.3.9018", "skip_test_strict", "")}
anl_rsp_comb_arms_ac <- anl %>%
mutate(is_rsp = AVALC %in% c("CR", "PR")) %>%
Expand Down Expand Up @@ -117,8 +118,7 @@ plot <- g_forest(tbl = result)
plot
```

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

## Plot Selecting Columns and <br/> Changing the Alpha Level
Expand All @@ -127,7 +127,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 plot3, test = list(plot_v3 = "plot"), fig.width = 10, fig.height = 4, 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 @@ -147,8 +149,7 @@ plot <- g_forest(tbl = result)
plot
```

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

## Plot with Fixed <br/> Symbol Size
Expand All @@ -157,7 +158,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,8 +183,7 @@ plot <- g_forest(
plot
```

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

## Plot of CR Only, Setting <br/> Values Indicating Response
Expand All @@ -190,7 +192,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 plot5, test = list(plot_v5 = "plot"), fig.width = 20, fig.height = 5, opts.label = ifelse(packageVersion("survival") < "3.5-8" || packageVersion("tern") < "0.9.3.9018", "skip_test_strict", "")}
anl_cr_arms_ab <- anl %>%
mutate(is_rsp = AVALC == "CR") %>%
Expand Down Expand Up @@ -227,8 +231,7 @@ width <- 20
height <- 5
```

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

{{< include ../../_utils/save_results.qmd >}}
Expand All @@ -244,11 +247,9 @@ 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 Expand Up @@ -306,5 +307,4 @@ shinyApp(app$ui, app$server)
:::

{{< include ../../repro.qmd >}}

::::
:::
31 changes: 13 additions & 18 deletions book/graphs/efficacy/fstg02.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ subtitle: Subgroup Analysis of Survival Duration

{{< include ../../_utils/envir_hook.qmd >}}

:::: {.panel-tabset}
::: panel-tabset
## Data Setup

```{r setup, message = FALSE}
Expand All @@ -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 All @@ -61,6 +59,7 @@ anl <- synthetic_cdisc_dataset("latest", "adtte") %>%
## {{< fa regular file-lines sm fw >}} Preview

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

```{r plot1, test = list(plot_v1 = "plot"), fig.width = 15, fig.height = 4, opts.label = ifelse(packageVersion("rtables") < "0.6.6.9011", "skip_test_strict", "")}
anl1 <- anl
Expand All @@ -82,8 +81,7 @@ plot <- g_forest(tbl = result)
plot
```

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

## Plot Specifying Class Variables and <br/> Options for the Treatment Variable
Expand All @@ -92,6 +90,7 @@ plot
## {{< fa regular file-lines sm fw >}} Preview

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

```{r plot2, test = list(plot_v2 = "plot"), fig.width = 15, fig.height = 4, opts.label = ifelse(packageVersion("rtables") < "0.6.6.9011", "skip_test_strict", "")}
anl2 <- anl %>%
mutate(
Expand Down Expand Up @@ -124,8 +123,7 @@ plot <- g_forest(tbl = result)
plot
```

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

## Plot Selecting Columns and <br/> Changing the Alpha Level
Expand All @@ -134,6 +132,7 @@ plot
## {{< fa regular file-lines sm fw >}} Preview

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

```{r plot3, test = list(plot_v3 = "plot"), fig.width = 8, fig.height = 4, opts.label = ifelse(packageVersion("rtables") < "0.6.6.9011", "skip_test_strict", "")}
anl3 <- anl
Expand All @@ -155,8 +154,7 @@ plot <- g_forest(tbl = result)
plot
```

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

## Plot with Fixed <br/> Symbol Size
Expand All @@ -165,6 +163,7 @@ plot
## {{< fa regular file-lines sm fw >}} Preview

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

```{r plot4, test = list(plot_v4 = "plot"), fig.width = 15, fig.height = 4, opts.label = ifelse(packageVersion("rtables") < "0.6.6.9011", "skip_test_strict", "")}
anl4 <- anl
Expand Down Expand Up @@ -195,8 +194,7 @@ height <- 4
plot_v3.width <- 8 # nolint: object_name.
```

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

{{< include ../../_utils/save_results.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 Expand Up @@ -282,5 +278,4 @@ shinyApp(app$ui, app$server)
:::

{{< include ../../repro.qmd >}}

::::
:::
Loading

0 comments on commit 1fb2d9e

Please sign in to comment.