Skip to content

Commit

Permalink
included code vignettes and fixing notes
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikeyakirar committed Nov 8, 2023
1 parent 07fd195 commit f3d6296
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 24 deletions.
12 changes: 8 additions & 4 deletions R/tm_g_barchart_simple.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@
#' @examples
#' library(nestcolor)
#'
#' ADSL <- tmc_ex_adsl %>% dplyr::mutate(ITTFL = factor("Y") %>%
#' ADSL <- tmc_ex_adsl %>%
#' dplyr::mutate(ITTFL = factor("Y") %>%
#' formatters::with_label("Intent-To-Treat Population Flag"))
#' ADAE <- tmc_ex_adae %>% dplyr::filter(!((AETOXGR == 1) & (AESEV == "MILD") & (ARM == "A: Drug X")))
#' ADAE <- tmc_ex_adae %>%
#' dplyr::filter(!((AETOXGR == 1) & (AESEV == "MILD") & (ARM == "A: Drug X")))
#'
#' app <- init(
#' data = cdisc_data(
#' ADSL = ADSL,
#' ADAE = ADAE,
#' code = "ADSL <- tmc_ex_adsl %>% dplyr::mutate(ITTFL = factor(\"Y\") %>%
#' code = "ADSL <- tmc_ex_adsl %>%
#' dplyr::mutate(ITTFL = factor(\"Y\") %>%
#' formatters::with_label(\"Intent-To-Treat Population Flag\"))
#' ADAE <- tmc_ex_adae %>% dplyr::filter(!((AETOXGR == 1) & (AESEV == \"MILD\") & (ARM == \"A: Drug X\")))"
#' ADAE <- tmc_ex_adae %>%
#' dplyr::filter(!((AETOXGR == 1) & (AESEV == \"MILD\") & (ARM == \"A: Drug X\")))"
#' ),
#' modules = modules(
#' tm_g_barchart_simple(
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_pp_therapy.R
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ template_therapy <- function(dataname = "ANL",
#' app <- init(
#' data = cdisc_data(
#' ADSL = ADSL,
#' ADCM = adcm,
#' ADCM = ADCM,
#' code = "
#' ADCM <- tmc_ex_adcm
#' ADSL <- tmc_ex_adsl %>% dplyr::filter(USUBJID %in% ADCM$USUBJID)
Expand Down
2 changes: 1 addition & 1 deletion R/tm_t_logistic.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ template_logistic <- function(dataname,
#' code = "
#' ADSL <- tmc_ex_adsl
#' ADRS <- tmc_ex_adrs %>%
#' dplyr::filter(PARAMCD %in% c("BESRSPI", "INVET"))
#' dplyr::filter(PARAMCD %in% c(\"BESRSPI\", \"INVET\"))
#' "
#' ),
#' modules = modules(
Expand Down
12 changes: 8 additions & 4 deletions man/tm_g_barchart_simple.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tm_g_pp_therapy.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tm_t_logistic.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 20 additions & 12 deletions vignettes/teal-modules-clinical.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,25 @@ A simple application including a bar chart module could look like this:
library(teal.modules.clinical)
library(nestcolor)

adsl <- tmc_ex_adsl
adae <- tmc_ex_adae
ADSL <- tmc_ex_adsl
ADAE <- tmc_ex_adae

app <- teal::init(
data = teal.data::cdisc_data(
ADSL = adsl,
ADAE = adae
ADSL = ADSL,
ADAE = ADAE,
code = "
ADSL <- tmc_ex_adsl
ADAE <- tmc_ex_adae
"
),
modules = list(
tm_g_barchart_simple(
label = "ADAE Analysis",
x = teal.transform::data_extract_spec(
dataname = "ADAE",
select = teal.transform::select_spec(
choices = teal.transform::variable_choices(adae),
choices = teal.transform::variable_choices(ADAE),
multiple = FALSE
)
)
Expand All @@ -90,8 +94,8 @@ library(nestcolor)
```
The above lines load the libraries used in this example. We will use the example data provided in the `teal.modules.clinical` package:
```r
adsl <- tmc_ex_adsl
adae <- tmc_ex_adae
ADSL <- tmc_ex_adsl
ADAE <- tmc_ex_adae
```
`nestcolor` is an optional package that can be loaded in to apply the standardized NEST color palette to all module plots.

Expand All @@ -103,15 +107,19 @@ argument indicates the modules included in the application. Here, we include onl
```r
app <- teal::init(
data = teal.data::cdisc_data(
ADSL = adsl,
ADAE = adae
ADSL = ADSL,
ADAE = ADAE,
code = "
ADSL <- tmc_ex_adsl
ADAE <- tmc_ex_adae
"
),
modules = list(
tm_g_barchart_simple(
label = "ADAE Analysis",
x = teal.transform::data_extract_spec(
dataname = "ADAE",
select = teal.transform::select_spec(choices = teal.transform::variable_choices(adae), multiple = FALSE)
select = teal.transform::select_spec(choices = teal.transform::variable_choices(ADAE), multiple = FALSE)
)
)
)
Expand All @@ -126,9 +134,9 @@ if (interactive()) shiny::shinyApp(app$ui, app$server)
Some of `teal.modules.clinical` modules allow specifying arguments using `teal.transform::choices_selected` such as
`tm_t_summary` module in this example:
```r
adsl <- tmc_ex_adsl
ADSL <- tmc_ex_adsl
app <- teal::init(
data = teal.data::cdisc_data(ADSL = adsl),
data = teal.data::cdisc_data(ADSL = ADSL, code = "ADSL <- tmc_ex_adsl"),
modules = list(
tm_t_summary(
label = "Demographic Table",
Expand Down

0 comments on commit f3d6296

Please sign in to comment.