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 3 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
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
39 changes: 19 additions & 20 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 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,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 Expand Up @@ -306,5 +306,4 @@ shinyApp(app$ui, app$server)
:::

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

::::
29 changes: 13 additions & 16 deletions book/graphs/efficacy/fstg02.qmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: FSTG02
subtitle: Subgroup Analysis of Survival Duration
editor_options:
chunk_output_type: console
ayogasekaram marked this conversation as resolved.
Show resolved Hide resolved
---

------------------------------------------------------------------------
Expand All @@ -17,8 +19,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 +51,7 @@ preprocess_adtte <- function(adtte) {
adtte
}

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

Expand All @@ -61,6 +61,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 +83,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 +92,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 +125,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 +134,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 +156,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 +165,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 +196,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 +212,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 +280,4 @@ shinyApp(app$ui, app$server)
:::

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

::::
Loading
Loading