Skip to content

Commit

Permalink
Create minimal test data for examples and initialize the substitution (
Browse files Browse the repository at this point in the history
  • Loading branch information
Melkiades authored Feb 23, 2023
1 parent b63ba64 commit 2ebf50c
Show file tree
Hide file tree
Showing 82 changed files with 1,401 additions and 636 deletions.
6 changes: 4 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# teal.modules.clinical 0.8.14.9020

### Breaking changes

* Replaced `chunks` with simpler `qenv` class.
* Replaced `datasets` argument containing `FilteredData` with the new arguments `data` (`tdata` object) and `filter_panel_api` (`FilterPanelAPI`).

Expand All @@ -13,10 +12,13 @@
* Added adjustment method choice to `tm_a_mmrm` to allow for Kenward-Roger adjustment of standard errors and p-values.

### Miscellaneous
* Package now uses `scda.2022` rather than `scda.2021` in SUGGESTS.
* Package now uses `scda.2022` rather than `scda.2021` in SUGGESTS.
* Removed unused argument `param` from `tm_g_pp_vitals`.
* Removed optimizer choice from `tm_a_mmrm` since we can just always use the
automatically determined optimizer.
* Creation of internal data for `adsl`, `adae`, `adlb`, `adcm`, `adrs`, and `adtte`. They are accessible
via `tmc_ex_*` prefix.
* Partial substitution of `scda` data with internal data in examples.

# teal.modules.clinical 0.8.14

Expand Down
29 changes: 29 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#' Simulated CDISC Data for Examples
#'
#' @format `rds` (`data.frame`)
#'
#' @name ex_data
NULL

#' @describeIn ex_data ADSL data
#'
"tmc_ex_adsl"

#' @describeIn ex_data ADAE data
#'
"tmc_ex_adae"

#' @describeIn ex_data ADLB data
#'
"tmc_ex_adlb"

#' @describeIn ex_data ADRS data
#'
"tmc_ex_adrs"

#' @describeIn ex_data ADTTE data
#'
"tmc_ex_adtte"
#' @describeIn ex_data ADCM data
#'
"tmc_ex_adcm"
4 changes: 1 addition & 3 deletions R/tm_a_gee.R
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ template_a_gee <- function(output_table,
#'
#' app <- init(
#' data = cdisc_data(
#' cdisc_dataset("ADSL", ADSL,
#' code = 'synthetic_cdisc_dataset("latest", "adsl")'
#' ),
#' cdisc_dataset("ADSL", ADSL),
#' cdisc_dataset("ADQS", ADQS,
#' code = 'ADQS <- synthetic_cdisc_dataset("latest", "adqs") %>%
#' dplyr::filter(ABLFL != "Y" & ABLFL2 != "Y") %>%
Expand Down
1 change: 0 additions & 1 deletion R/tm_a_mmrm.R
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ template_mmrm_plots <- function(fit_name,
#' numerical precision.
#'
#' @examples
#'
#' library(scda)
#'
#' ADSL <- synthetic_cdisc_dataset("latest", "adsl")
Expand Down
17 changes: 5 additions & 12 deletions R/tm_g_barchart_simple.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
#'
#' @examples
#' library(dplyr)
#' library(scda)
#' library(nestcolor)
#'
#' ADSL <- synthetic_cdisc_dataset("latest", "adsl")
#' ADAE <- synthetic_cdisc_dataset("latest", "adae")
#' ADSL <- tmc_ex_adsl %>%
#' dplyr::mutate(ITTFL = factor("Y"))
#' ADAE <- tmc_ex_adae
#'
#' adae_labels <- formatters::var_labels(ADAE, fill = FALSE)
#' ADAE <- ADAE %>% dplyr::filter(!((AETOXGR == 1) & (AESEV == "MILD") & (ARM == "A: Drug X")))
Expand All @@ -29,15 +29,8 @@
#'
#' app <- init(
#' data = cdisc_data(
#' cdisc_dataset("ADSL", ADSL, code = 'ADSL <- synthetic_cdisc_dataset("latest", "adsl")'),
#' cdisc_dataset("ADAE", ADAE,
#' code = 'ADAE <- synthetic_cdisc_dataset("latest", "adae")
#' adae_labels <- formatters::var_labels(ADAE, fill = FALSE)
#' ADAE <- ADAE %>%
#' dplyr::filter(!((AETOXGR == 1) & (AESEV == "MILD") & (ARM == "A: Drug X")))
#' formatters::var_labels(ADAE) <- adae_labels
#' ADAE'
#' )
#' cdisc_dataset("ADSL", ADSL),
#' cdisc_dataset("ADAE", ADAE)
#' ),
#' modules = modules(
#' tm_g_barchart_simple(
Expand Down
12 changes: 5 additions & 7 deletions R/tm_g_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -188,19 +188,17 @@ template_g_ci <- function(dataname, # nolint
#' and point shape).
#'
#' @export
#' @examples
#'
#' library(scda)
#' @examples
#' library(nestcolor)
#' ADSL <- synthetic_cdisc_dataset("latest", "adsl")
#' ADLB <- synthetic_cdisc_dataset("latest", "adlb")
#'
#' ADSL <- tmc_ex_adsl
#' ADLB <- tmc_ex_adlb
#'
#' app <- init(
#' data = cdisc_data(
#' cdisc_dataset("ADSL", ADSL),
#' cdisc_dataset("ADLB", ADLB),
#' code = 'ADSL <- synthetic_cdisc_dataset("latest", "adsl")
#' ADLB <- synthetic_cdisc_dataset("latest", "adlb")' # nolint
#' cdisc_dataset("ADLB", ADLB)
#' ),
#' modules = modules(
#' tm_g_ci(
Expand Down
15 changes: 4 additions & 11 deletions R/tm_g_forest_rsp.R
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,12 @@ template_forest_rsp <- function(dataname = "ANL",
#' @template author_song24
#'
#' @examples
#'
#' library(scda)
#' library(dplyr)
#' library(nestcolor)
#'
#' ADSL <- synthetic_cdisc_dataset("latest", "adsl")
#' ADRS <- synthetic_cdisc_dataset("latest", "adrs") %>%
#' mutate(AVALC = d_onco_rsp_label(AVALC)) %>%
#' ADSL <- tmc_ex_adsl
#' ADRS <- tmc_ex_adrs %>%
#' mutate(AVALC = tern::d_onco_rsp_label(AVALC)) %>%
#' filter(PARAMCD != "OVRINV" | AVISIT == "FOLLOW UP")
#'
#' arm_ref_comp <- list(
Expand All @@ -239,12 +237,7 @@ template_forest_rsp <- function(dataname = "ANL",
#' app <- init(
#' data = cdisc_data(
#' cdisc_dataset("ADSL", ADSL),
#' cdisc_dataset("ADRS", ADRS),
#' code =
#' 'ADSL <- synthetic_cdisc_dataset("latest", "adsl")
#' ADRS <- synthetic_cdisc_dataset("latest", "adrs") %>%
#' mutate(AVALC = d_onco_rsp_label(AVALC)) %>%
#' filter(PARAMCD != "OVRINV" | AVISIT == "FOLLOW UP")' # nolint
#' cdisc_dataset("ADRS", ADRS)
#' ),
#' modules = modules(
#' tm_g_forest_rsp(
Expand Down
16 changes: 4 additions & 12 deletions R/tm_g_forest_tte.R
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,10 @@ template_forest_tte <- function(dataname = "ANL",
#' @export
#'
#' @examples
#' library(scda)
#' library(nestcolor)
#'
#' ADSL <- synthetic_cdisc_dataset("latest", "adsl")
#' ADTTE <- synthetic_cdisc_dataset("latest", "adtte")
#' ADSL <- tmc_ex_adsl
#' ADTTE <- tmc_ex_adtte
#'
#' ADSL$RACE <- droplevels(ADSL$RACE)
#'
Expand All @@ -245,15 +244,8 @@ template_forest_tte <- function(dataname = "ANL",
#'
#' app <- init(
#' data = cdisc_data(
#' cdisc_dataset(
#' "ADSL", ADSL,
#' code = 'ADSL <- synthetic_cdisc_dataset("latest", "adsl")
#' ADSL$RACE <- droplevels(ADSL$RACE)' # nolint
#' ),
#' cdisc_dataset(
#' "ADTTE", ADTTE,
#' code = 'ADTTE <- synthetic_cdisc_dataset("latest", "adtte")'
#' )
#' cdisc_dataset("ADSL", ADSL),
#' cdisc_dataset("ADTTE", ADTTE)
#' ),
#' modules = modules(
#' tm_g_forest_tte(
Expand Down
14 changes: 4 additions & 10 deletions R/tm_g_ipp.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,10 @@ template_g_ipp <- function(dataname = "ANL",
#'
#' @examples
#' library(dplyr)
#' library(scda)
#' library(nestcolor)
#'
#' adsl <- synthetic_cdisc_dataset("latest", "adsl") %>% slice(1:20)
#' adlb <- synthetic_cdisc_dataset("latest", "adlb")
#' adsl <- tmc_ex_adsl %>% slice(1:20)
#' adlb <- tmc_ex_adlb
#' adlb <- adlb %>% filter(USUBJID %in% adsl$USUBJID)
#'
#' adsl <- df_explicit_na(adsl)
Expand All @@ -202,16 +201,11 @@ template_g_ipp <- function(dataname = "ANL",
#' data = cdisc_data(
#' cdisc_dataset(
#' "ADSL",
#' adsl,
#' code = 'ADSL <- synthetic_cdisc_dataset("latest", "adsl") %>% slice(1:20)
#' ADSL <- df_explicit_na(ADSL)' # nolint
#' adsl
#' ),
#' cdisc_dataset(
#' "ADLB",
#' adlb,
#' code = 'ADLB <- synthetic_cdisc_dataset("latest", "adlb")
#' ADLB <- df_explicit_na(ADLB) %>%
#' dplyr::filter(AVISIT != "SCREENING")' # nolint
#' adlb
#' )
#' ),
#' modules = modules(
Expand Down
9 changes: 4 additions & 5 deletions R/tm_g_km.R
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,10 @@ template_g_km <- function(dataname = "ANL",
#' @export
#'
#' @examples
#' library(scda)
#' library(nestcolor)
#'
#' ADSL <- synthetic_cdisc_dataset("latest", "adsl")
#' ADTTE <- synthetic_cdisc_dataset("latest", "adtte")
#' ADSL <- tmc_ex_adsl
#' ADTTE <- tmc_ex_adtte
#'
#' arm_ref_comp <- list(
#' ACTARMCD = list(
Expand All @@ -258,8 +257,8 @@ template_g_km <- function(dataname = "ANL",
#'
#' app <- init(
#' data = cdisc_data(
#' cdisc_dataset("ADSL", ADSL, code = 'ADSL <- synthetic_cdisc_dataset("latest", "adsl")'),
#' cdisc_dataset("ADTTE", ADTTE, code = 'ADTTE <- synthetic_cdisc_dataset("latest", "adtte")')
#' cdisc_dataset("ADSL", ADSL),
#' cdisc_dataset("ADTTE", ADTTE)
#' ),
#' modules = modules(
#' tm_g_km(
Expand Down
14 changes: 4 additions & 10 deletions R/tm_g_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -203,23 +203,17 @@ template_g_lineplot <- function(dataname = "ANL",
#' @export
#'
#' @examples
#' library(scda)
#' library(nestcolor)
#'
#' ADSL <- synthetic_cdisc_dataset("latest", "adsl")
#' ADLB <- synthetic_cdisc_dataset("latest", "adlb")
#' ADSL <- tmc_ex_adsl
#' ADLB <- tmc_ex_adlb
#'
#' ADLB <- dplyr::mutate(ADLB, AVISIT == forcats::fct_reorder(AVISIT, AVISITN, min))
#'
#' app <- init(
#' data = cdisc_data(
#' cdisc_dataset("ADSL", ADSL,
#' code = 'ADSL <- synthetic_cdisc_dataset("latest", "adsl")'
#' ),
#' cdisc_dataset("ADLB", ADLB,
#' code = 'ADLB <- synthetic_cdisc_dataset("latest", "adlb")
#' ADLB <- dplyr::mutate(ADLB, AVISIT == forcats::fct_reorder(AVISIT, AVISITN, min))' # nolint
#' )
#' cdisc_dataset("ADSL", ADSL),
#' cdisc_dataset("ADLB", ADLB)
#' ),
#' modules = modules(
#' tm_g_lineplot(
Expand Down
13 changes: 4 additions & 9 deletions R/tm_g_pp_adverse_events.R
Original file line number Diff line number Diff line change
Expand Up @@ -180,20 +180,15 @@ template_adverse_events <- function(dataname = "ANL",
#' @export
#'
#' @examples
#' library(scda)
#' library(nestcolor)
#'
#' ADSL <- synthetic_cdisc_dataset("latest", "adsl")
#' ADAE <- synthetic_cdisc_dataset("latest", "adae")
#' ADSL <- tmc_ex_adsl
#' ADAE <- tmc_ex_adae
#'
#' app <- init(
#' data = cdisc_data(
#' cdisc_dataset("ADSL", ADSL,
#' code = 'ADSL <- synthetic_cdisc_dataset("latest", "adsl")'
#' ),
#' cdisc_dataset("ADAE", ADAE,
#' code = 'ADAE <- synthetic_cdisc_dataset("latest", "adae")'
#' )
#' cdisc_dataset("ADSL", ADSL),
#' cdisc_dataset("ADAE", ADAE)
#' ),
#' modules = modules(
#' tm_g_pp_adverse_events(
Expand Down
9 changes: 4 additions & 5 deletions R/tm_g_pp_patient_timeline.R
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,13 @@ template_patient_timeline <- function(dataname = "ANL",
#' @export
#'
#' @examples
#' library(scda)
#' library(nestcolor)
#'
#' ADSL <- synthetic_cdisc_dataset("latest", "adsl")
#' ADAE <- synthetic_cdisc_dataset("latest", "adae")
#' ADCM <- synthetic_cdisc_dataset("latest", "adcm")
#' ADSL <- tmc_ex_adsl
#' ADAE <- tmc_ex_adae
#' ADCM <- tmc_ex_adcm
#'
#' #' Modify ADCM
#' # Modify ADCM
#' ADCM$CMINDC <- paste0("Indication_", as.numeric(ADCM$CMDECOD))
#' ADCM$CMDOSE <- 1
#' ADCM$CMDOSU <- "U"
Expand Down
27 changes: 4 additions & 23 deletions R/tm_g_pp_therapy.R
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,12 @@ template_therapy <- function(dataname = "ANL",
#' @export
#'
#' @examples
#' library(scda)
#' library(nestcolor)
#'
#' ADSL <- synthetic_cdisc_dataset("latest", "adsl")
#' ADCM <- synthetic_cdisc_dataset("latest", "adcm")
#' ADSL <- tmc_ex_adsl
#' ADCM <- tmc_ex_adcm
#'
#' #' Modify ADCM
#' # Modify ADCM
#' ADCM$CMINDC <- paste0("Indication_", as.numeric(ADCM$CMDECOD))
#' ADCM$CMDOSE <- 1
#' ADCM$CMTRT <- ADCM$CMCAT
Expand All @@ -280,26 +279,8 @@ template_therapy <- function(dataname = "ANL",
#'
#' app <- init(
#' data = cdisc_data(
#' cdisc_dataset("ADSL", ADSL,
#' code = 'ADSL <- synthetic_cdisc_dataset("latest", "adsl")'
#' ),
#' cdisc_dataset("ADSL", ADSL),
#' cdisc_dataset("ADCM", ADCM,
#' code = 'ADCM <- synthetic_cdisc_dataset("latest", "adcm")
#' ADCM$CMINDC <- paste0("Indication_", as.numeric(ADCM$CMDECOD))
#' ADCM$CMDOSE <- 1
#' ADCM$CMTRT <- ADCM$CMCAT
#' ADCM$CMDOSU <- "U"
#' ADCM$CMROUTE <- "CMROUTE"
#' ADCM$CMDOSFRQ <- "CMDOSFRQ"
#' ADCM$CMASTDTM <- ADCM$ASTDTM
#' ADCM$CMAENDTM <- ADCM$AENDTM
#' formatters::var_labels(
#' ADCM[c("CMINDC", "CMTRT", "ASTDY", "AENDY")]) <- c(
#' "Indication",
#' "Reported Name of Drug, Med, or Therapy",
#' "Study Day of Start of Medication",
#' "Study Day of End of Medication")
#' ADCM',
#' keys = adcm_keys
#' )
#' ),
Expand Down
1 change: 1 addition & 0 deletions R/tm_g_pp_vitals.R
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ template_vitals <- function(dataname = "ANL",
#' @examples
#' library(scda)
#' library(nestcolor)
#'
#' ADSL <- synthetic_cdisc_dataset("latest", "adsl")
#' ADVS <- synthetic_cdisc_dataset("latest", "advs")
#'
Expand Down
Loading

0 comments on commit 2ebf50c

Please sign in to comment.