diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 4bce0c86d..e7b7ebc6b 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -51,12 +51,10 @@ jobs: additional-env-vars: | _R_CHECK_EXAMPLE_TIMING_THRESHOLD_=11 TESTING_DEPTH=5 + NOT_CRAN=true enforce-note-blocklist: true - publish-unit-test-report-gh-pages: false - junit-xml-comparison: false concurrency-group: non-cran - disable-unit-test-reports: true - skip-r-cmd-install: true + unit-test-report-directory: unit-test-report-non-cran note-blocklist: | checking dependencies in R code .* NOTE checking R code for possible problems .* NOTE @@ -71,6 +69,9 @@ jobs: uses: insightsengineering/r.pkg.template/.github/workflows/test-coverage.yaml@main secrets: REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} + with: + additional-env-vars: | + NOT_CRAN=true linter: if: github.event_name != 'push' name: SuperLinter πŸ¦Έβ€β™€οΈ diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 9b7a7e54e..57ae80042 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -41,3 +41,4 @@ jobs: REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} with: default-landing-page: latest-tag + additional-unit-test-report-directories: unit-test-report-non-cran diff --git a/.github/workflows/on-demand.yaml b/.github/workflows/on-demand.yaml deleted file mode 100644 index 02843bb32..000000000 --- a/.github/workflows/on-demand.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- -name: On-demand πŸ§‘β€πŸ”¬ - -on: - schedule: - - cron: '45 3 * * 0' - workflow_dispatch: - -jobs: - revdepcheck: - name: revdepcheck ↩️ - uses: insightsengineering/r.pkg.template/.github/workflows/revdepcheck.yaml@main diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 226473ce9..aa3e7bb45 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -52,3 +52,10 @@ jobs: uses: insightsengineering/r.pkg.template/.github/workflows/test-coverage.yaml@main secrets: REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} + with: + additional-env-vars: | + NOT_CRAN=true + wasm: + name: Build WASM packages πŸ§‘β€πŸ­ + needs: release + uses: insightsengineering/r.pkg.template/.github/workflows/wasm.yaml@main diff --git a/.github/workflows/scheduled.yaml b/.github/workflows/scheduled.yaml index f2ddf6862..2aace5e2b 100644 --- a/.github/workflows/scheduled.yaml +++ b/.github/workflows/scheduled.yaml @@ -5,9 +5,26 @@ on: schedule: - cron: '45 3 * * 0' workflow_dispatch: + inputs: + chosen-workflow: + description: | + Select which workflow you'd like to run + required: true + type: choice + default: rhub + options: + - rhub + - dependency-test + - branch-cleanup + - revdepcheck jobs: dependency-test: + if: > + github.event_name == 'schedule' || ( + github.event_name == 'workflow_dispatch' && + inputs.chosen-workflow == 'dependency-test' + ) strategy: fail-fast: false matrix: @@ -22,7 +39,54 @@ jobs: additional-env-vars: | PKG_SYSREQS_DRY_RUN=true branch-cleanup: + if: > + github.event_name == 'schedule' || ( + github.event_name == 'workflow_dispatch' && + inputs.chosen-workflow == 'branch-cleanup' + ) name: Branch Cleanup 🧹 uses: insightsengineering/r.pkg.template/.github/workflows/branch-cleanup.yaml@main secrets: REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} + revdepcheck: + if: > + github.event_name == 'schedule' || ( + github.event_name == 'workflow_dispatch' && + inputs.chosen-workflow == 'revdepcheck' + ) + name: revdepcheck ↩️ + uses: insightsengineering/r.pkg.template/.github/workflows/revdepcheck.yaml@main + with: + lookup-refs: | + insightsengineering/roxy.shinylive + insightsengineering/teal + insightsengineering/teal.transform + insightsengineering/teal.code + insightsengineering/teal.data + insightsengineering/teal.slice + insightsengineering/teal.logger + insightsengineering/teal.reporter + insightsengineering/teal.widgets + insightsengineering/tern + insightsengineering/rtables + rhub: + if: > + github.event_name == 'schedule' || ( + github.event_name == 'workflow_dispatch' && + inputs.chosen-workflow == 'rhub' + ) + name: R-hub 🌐 + uses: insightsengineering/r.pkg.template/.github/workflows/rhub.yaml@main + with: + lookup-refs: | + insightsengineering/roxy.shinylive + insightsengineering/teal + insightsengineering/teal.transform + insightsengineering/teal.code + insightsengineering/teal.data + insightsengineering/teal.slice + insightsengineering/teal.logger + insightsengineering/teal.reporter + insightsengineering/teal.widgets + insightsengineering/tern + insightsengineering/rtables diff --git a/.gitignore b/.gitignore index fb00dbe32..1657ceda4 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,5 @@ vignettes/*.R coverage.* tests/testthat/_snaps/**/*.new.md tests/testthat/_snaps/**/*.new.svg +/doc/ +/Meta/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6684c09a0..b154dbae6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,12 @@ --- # All available hooks: https://pre-commit.com/hooks.html # R specific hooks: https://github.com/lorenzwalthert/precommit -default_stages: [commit] +default_stages: [pre-commit] default_language_version: python: python3 repos: - repo: https://github.com/lorenzwalthert/precommit - rev: v0.4.2 + rev: v0.4.3.9003 hooks: - id: style-files name: Style code with `styler` @@ -18,8 +18,6 @@ repos: - ggmosaic - ggplot2 - shiny - - teal - - teal.transform - checkmate - dplyr - DT @@ -33,6 +31,9 @@ repos: - shinyWidgets - stats - stringr + - insightsengineering/roxy.shinylive + - insightsengineering/teal + - insightsengineering/teal.transform - insightsengineering/teal.code - insightsengineering/teal.data - insightsengineering/teal.logger diff --git a/DESCRIPTION b/DESCRIPTION index ba2a83e99..cb6eee452 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: teal.modules.general Title: General Modules for 'teal' Applications -Version: 0.3.0.9038 -Date: 2024-06-27 +Version: 0.3.0.9054 +Date: 2024-11-08 Authors@R: c( person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre")), person("Pawel", "Rucki", , "pawel.rucki@roche.com", role = "aut"), @@ -27,8 +27,8 @@ Depends: ggplot2 (>= 3.4.0), R (>= 3.6), shiny (>= 1.6.0), - teal (>= 0.15.1), - teal.transform (>= 0.5.0) + teal (>= 0.15.2.9079), + teal.transform (>= 0.5.0.9015) Imports: broom (>= 0.7.10), checkmate (>= 2.1.0), @@ -49,8 +49,8 @@ Imports: shinyWidgets (>= 0.5.1), stats, stringr (>= 1.4.1), - teal.code (>= 0.5.0), - teal.data (>= 0.5.0), + teal.code (>= 0.5.0.9012), + teal.data (>= 0.6.0.9015), teal.logger (>= 0.2.0.9004), teal.reporter (>= 0.3.0), teal.widgets (>= 0.4.0), @@ -72,6 +72,7 @@ Suggests: pkgload, rlang (>= 1.0.0), rmarkdown (>= 2.23), + roxy.shinylive, rtables (>= 0.6.8), rvest, shinytest2, @@ -79,7 +80,8 @@ Suggests: testthat (>= 3.1.9), withr (>= 2.0.0) VignetteBuilder: - knitr + knitr, + rmarkdown Config/Needs/verdepcheck: haleyjeppson/ggmosaic, tidyverse/ggplot2, rstudio/shiny, insightsengineering/teal, insightsengineering/teal.transform, mllg/checkmate, tidyverse/dplyr, @@ -91,15 +93,14 @@ Config/Needs/verdepcheck: haleyjeppson/ggmosaic, tidyverse/ggplot2, insightsengineering/tern, tidyverse/tibble, tidyverse/tidyr, tidymodels/broom, daattali/colourpicker, daattali/ggExtra, aphalo/ggpmisc, aphalo/ggpp, slowkow/ggrepel, baddstats/goftest, - gridExtra, ramnathv/htmlwidgets, jeroen/jsonlite, yihui/knitr, - daroczig/logger, deepayan/lattice, MASS, - insightsengineering/nestcolor, r-lib/rlang, rstudio/rmarkdown, - insightsengineering/rtables, tidyverse/rvest, sparkline, - rstudio/shinytest2, insightsengineering/teal.data, r-lib/testthat, - r-lib/withr + ramnathv/htmlwidgets, jeroen/jsonlite, yihui/knitr, daroczig/logger, + deepayan/lattice, insightsengineering/nestcolor, r-lib/pkgload, + r-lib/rlang, rstudio/rmarkdown, insightsengineering/roxy.shinylive, + insightsengineering/rtables, tidyverse/rvest, htmlwidgets/sparkline, + rstudio/shinytest2, r-lib/testthat, r-lib/withr Config/Needs/website: insightsengineering/nesttemplate Encoding: UTF-8 Language: en-US LazyData: true -Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1 +Roxygen: list(markdown = TRUE, packages = c("roxy.shinylive")) +RoxygenNote: 7.3.2 diff --git a/NEWS.md b/NEWS.md index 029e1412b..dea3b1d7e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,14 +1,17 @@ -# teal.modules.general 0.3.0.9038 +# teal.modules.general 0.3.0.9054 * Removed `Show Warnings` modals from modules. ### Enhancements * Added `teal.logger` functionality for logging changes in shiny inputs in all modules. +### Bug fixes +* Fixed a bug in `tm_missing_data` in "Group by Subject" that was not using reactive data call. + # teal.modules.general 0.3.0 ### Enhancements -* Updated the package docs and vignettes with the new way of specifying data for `teal::init()`. The `data` argument will accept a `teal_data` object +* Updated the package docs and vignettes with the new way of specifying data for `teal::init()`. The `data` argument will accept a `teal_data` object. ### Bug fixes * Outlier labels no longer appear out of bounds in `tm_a_regression`. diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index b2c0a1a2e..7753c3101 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -18,9 +18,11 @@ #' #' @inherit shared_params return #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} #' @examples -#' library(teal.widgets) -#' #' # general data example #' data <- teal_data() #' data <- within(data, { @@ -28,8 +30,6 @@ #' USArrests <- USArrests #' }) #' -#' datanames(data) <- "USArrests" -#' #' app <- init( #' data = data, #' modules = modules( @@ -45,9 +45,6 @@ #' multiple = TRUE #' ), #' filter = NULL -#' ), -#' ggplot2_args = ggplot2_args( -#' labs = list(subtitle = "Plot generated by PCA Module") #' ) #' ) #' ) @@ -56,14 +53,18 @@ #' shinyApp(app$ui, app$server) #' } #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +#' @examples #' # CDISC data example #' data <- teal_data() #' data <- within(data, { #' require(nestcolor) #' ADSL <- rADSL #' }) -#' datanames(data) <- "ADSL" -#' join_keys(data) <- default_cdisc_join_keys[datanames(data)] +#' join_keys(data) <- default_cdisc_join_keys[names(data)] #' #' app <- init( #' data = data, @@ -80,9 +81,6 @@ #' multiple = TRUE #' ), #' filter = NULL -#' ), -#' ggplot2_args = ggplot2_args( -#' labs = list(subtitle = "Plot generated by PCA Module") #' ) #' ) #' ) diff --git a/R/tm_a_regression.R b/R/tm_a_regression.R index a941e5e20..4e28de543 100644 --- a/R/tm_a_regression.R +++ b/R/tm_a_regression.R @@ -42,16 +42,17 @@ #' #' @inherit shared_params return #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} #' @examples #' # general data example -#' library(teal.widgets) -#' #' data <- teal_data() #' data <- within(data, { #' require(nestcolor) #' CO2 <- CO2 #' }) -#' datanames(data) <- c("CO2") #' #' app <- init( #' data = data, @@ -77,9 +78,6 @@ #' multiple = TRUE, #' fixed = FALSE #' ) -#' ), -#' ggplot2_args = ggplot2_args( -#' labs = list(subtitle = "Plot generated by Regression Module") #' ) #' ) #' ) @@ -88,16 +86,18 @@ #' shinyApp(app$ui, app$server) #' } #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +#' @examples #' # CDISC data example -#' library(teal.widgets) -#' #' data <- teal_data() #' data <- within(data, { #' require(nestcolor) #' ADSL <- rADSL #' }) -#' datanames(data) <- "ADSL" -#' join_keys(data) <- default_cdisc_join_keys[datanames(data)] +#' join_keys(data) <- default_cdisc_join_keys[names(data)] #' #' app <- init( #' data = data, @@ -123,9 +123,6 @@ #' multiple = TRUE, #' fixed = FALSE #' ) -#' ), -#' ggplot2_args = ggplot2_args( -#' labs = list(subtitle = "Plot generated by Regression Module") #' ) #' ) #' ) diff --git a/R/tm_data_table.R b/R/tm_data_table.R index 2d215f8c9..2a688f7d7 100644 --- a/R/tm_data_table.R +++ b/R/tm_data_table.R @@ -29,6 +29,10 @@ #' #' @inherit shared_params return #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} #' @examples #' # general data example #' data <- teal_data() @@ -36,7 +40,6 @@ #' require(nestcolor) #' iris <- iris #' }) -#' datanames(data) <- c("iris") #' #' app <- init( #' data = data, @@ -53,14 +56,18 @@ #' shinyApp(app$ui, app$server) #' } #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +#' @examples #' # CDISC data example #' data <- teal_data() #' data <- within(data, { #' require(nestcolor) #' ADSL <- rADSL #' }) -#' datanames(data) <- "ADSL" -#' join_keys(data) <- default_cdisc_join_keys[datanames(data)] +#' join_keys(data) <- default_cdisc_join_keys[names(data)] #' #' app <- init( #' data = data, @@ -187,7 +194,7 @@ srv_page_data_table <- function(id, if_filtered <- reactive(as.logical(input$if_filtered)) if_distinct <- reactive(as.logical(input$if_distinct)) - datanames <- isolate(teal.data::datanames(data())) + datanames <- isolate(names(data())) datanames <- Filter(function(name) { is.data.frame(isolate(data())[[name]]) }, datanames) diff --git a/R/tm_file_viewer.R b/R/tm_file_viewer.R index 3b96185bb..ee2d50acb 100644 --- a/R/tm_file_viewer.R +++ b/R/tm_file_viewer.R @@ -13,12 +13,15 @@ #' #' @inherit shared_params return #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} #' @examples #' data <- teal_data() #' data <- within(data, { #' data <- data.frame(1) #' }) -#' datanames(data) <- c("data") #' #' app <- init( #' data = data, diff --git a/R/tm_front_page.R b/R/tm_front_page.R index fbffb8769..6cdbb0ce8 100644 --- a/R/tm_front_page.R +++ b/R/tm_front_page.R @@ -17,6 +17,10 @@ #' #' @inherit shared_params return #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} #' @examples #' data <- teal_data() #' data <- within(data, { @@ -24,8 +28,7 @@ #' ADSL <- rADSL #' attr(ADSL, "metadata") <- list("Author" = "NEST team", "data_source" = "synthetic data") #' }) -#' datanames(data) <- "ADSL" -#' join_keys(data) <- default_cdisc_join_keys[datanames(data)] +#' join_keys(data) <- default_cdisc_join_keys[names(data)] #' #' table_1 <- data.frame(Info = c("A", "B"), Text = c("A", "B")) #' table_2 <- data.frame(`Column 1` = c("C", "D"), `Column 2` = c(5.5, 6.6), `Column 3` = c("A", "B")) @@ -165,7 +168,7 @@ srv_front_page <- function(id, data, tables, show_metadata) { ) metadata_data_frame <- reactive({ - datanames <- teal.data::datanames(data()) + datanames <- names(data()) convert_metadata_to_dataframe( lapply(datanames, function(dataname) attr(data()[[dataname]], "metadata")), datanames diff --git a/R/tm_g_association.R b/R/tm_g_association.R index b0611490c..3611df804 100644 --- a/R/tm_g_association.R +++ b/R/tm_g_association.R @@ -25,9 +25,11 @@ #' #' @inherit shared_params return #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} #' @examples -#' library(teal.widgets) -#' #' # general data example #' data <- teal_data() #' data <- within(data, { @@ -36,7 +38,6 @@ #' factors <- names(Filter(isTRUE, vapply(CO2, is.factor, logical(1L)))) #' CO2[factors] <- lapply(CO2[factors], as.character) #' }) -#' datanames(data) <- c("CO2") #' #' app <- init( #' data = data, @@ -60,9 +61,6 @@ #' multiple = TRUE, #' fixed = FALSE #' ) -#' ), -#' ggplot2_args = ggplot2_args( -#' labs = list(subtitle = "Plot generated by Association Module") #' ) #' ) #' ) @@ -71,14 +69,18 @@ #' shinyApp(app$ui, app$server) #' } #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +#' @examples #' # CDISC data example #' data <- teal_data() #' data <- within(data, { #' require(nestcolor) #' ADSL <- rADSL #' }) -#' datanames(data) <- "ADSL" -#' join_keys(data) <- default_cdisc_join_keys[datanames(data)] +#' join_keys(data) <- default_cdisc_join_keys[names(data)] #' #' app <- init( #' data = data, @@ -108,9 +110,6 @@ #' multiple = TRUE, #' fixed = FALSE #' ) -#' ), -#' ggplot2_args = ggplot2_args( -#' labs = list(subtitle = "Plot generated by Association Module") #' ) #' ) #' ) diff --git a/R/tm_g_bivariate.R b/R/tm_g_bivariate.R index 807b4f23b..4e93151b9 100644 --- a/R/tm_g_bivariate.R +++ b/R/tm_g_bivariate.R @@ -46,16 +46,17 @@ #' #' @inherit shared_params return #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} #' @examples -#' library(teal.widgets) -#' #' # general data example #' data <- teal_data() #' data <- within(data, { #' require(nestcolor) #' CO2 <- data.frame(CO2) #' }) -#' datanames(data) <- c("CO2") #' #' app <- init( #' data = data, @@ -96,9 +97,6 @@ #' selected = "Treatment", #' fixed = FALSE #' ) -#' ), -#' ggplot2_args = ggplot2_args( -#' labs = list(subtitle = "Plot generated by Bivariate Module") #' ) #' ) #' ) @@ -106,15 +104,18 @@ #' shinyApp(app$ui, app$server) #' } #' -#' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +#' @examples #' # CDISC data example #' data <- teal_data() #' data <- within(data, { #' require(nestcolor) #' ADSL <- rADSL #' }) -#' datanames(data) <- c("ADSL") -#' join_keys(data) <- default_cdisc_join_keys[datanames(data)] +#' join_keys(data) <- default_cdisc_join_keys[names(data)] #' #' app <- init( #' data = data, @@ -155,9 +156,6 @@ #' selected = "COUNTRY", #' fixed = FALSE #' ) -#' ), -#' ggplot2_args = ggplot2_args( -#' labs = list(subtitle = "Plot generated by Bivariate Module") #' ) #' ) #' ) diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index aefa575c3..9fc6e3a6b 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -27,15 +27,18 @@ #' #' @inherit shared_params return #' -#' @examples -#' library(teal.widgets) -#' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +# nolint start: line_length_linter. +#' @examplesIf require("ggpmisc", quietly = TRUE) && require("ggpp", quietly = TRUE) && require("goftest", quietly = TRUE) && require("MASS", quietly = TRUE) && require("broom", quietly = TRUE) +# nolint end: line_length_linter. #' # general data example #' data <- teal_data() #' data <- within(data, { #' iris <- iris #' }) -#' datanames(data) <- "iris" #' #' app <- init( #' data = data, @@ -44,9 +47,6 @@ #' dist_var = data_extract_spec( #' dataname = "iris", #' select = select_spec(variable_choices("iris"), "Petal.Length") -#' ), -#' ggplot2_args = ggplot2_args( -#' labs = list(subtitle = "Plot generated by Distribution Module") #' ) #' ) #' ) @@ -55,13 +55,19 @@ #' shinyApp(app$ui, app$server) #' } #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +# nolint start: line_length_linter. +#' @examplesIf require("ggpmisc", quietly = TRUE) && require("ggpp", quietly = TRUE) && require("goftest", quietly = TRUE) && require("MASS", quietly = TRUE) && require("broom", quietly = TRUE) +# nolint end: line_length_linter. #' # CDISC data example #' data <- teal_data() #' data <- within(data, { #' ADSL <- rADSL #' }) -#' datanames(data) <- c("ADSL") -#' join_keys(data) <- default_cdisc_join_keys[datanames(data)] +#' join_keys(data) <- default_cdisc_join_keys[names(data)] #' #' vars1 <- choices_selected( #' variable_choices(data[["ADSL"]], c("ARM", "COUNTRY", "SEX")), @@ -94,9 +100,6 @@ #' vars = vars1, #' multiple = TRUE #' ) -#' ), -#' ggplot2_args = ggplot2_args( -#' labs = list(subtitle = "Plot generated by Distribution Module") #' ) #' ) #' ) @@ -500,11 +503,8 @@ srv_distribution <- function(id, selector_list()$dist_i()$select ), handlerExpr = { - req(input$params_reset) params <- if (length(input$t_dist) != 0) { - dist_var2 <- as.vector(merged$anl_input_r()$columns_source$dist_i) - get_dist_params <- function(x, dist) { if (dist == "unif") { return(stats::setNames(range(x, na.rm = TRUE), c("min", "max"))) @@ -519,8 +519,8 @@ srv_distribution <- function(id, ) } - ANL <- merged$anl_q_r()[[as.character(dist_var[[1]]$dataname)]] - round(get_dist_params(as.numeric(stats::na.omit(ANL[[dist_var2]])), input$t_dist), 2) + ANL <- merged$anl_q_r()[["ANL"]] + round(get_dist_params(as.numeric(stats::na.omit(ANL[[merge_vars()$dist_var]])), input$t_dist), 2) } else { c("param1" = NA_real_, "param2" = NA_real_) } @@ -1212,15 +1212,15 @@ srv_distribution <- function(id, # wrapped in if since could lead into validate error - we do want to continue test_r_qenv_out <- try(test_q(), silent = TRUE) if (!inherits(test_r_qenv_out, c("try-error", "error"))) { - qenv_final <- teal.code::join(qenv_final, test_q()) + qenv_final <- c(qenv_final, test_q()) } qenv_final <- if (tab == "Histogram") { req(dist_q()) - teal.code::join(qenv_final, dist_q()) + c(qenv_final, dist_q()) } else if (tab == "QQplot") { req(qq_q()) - teal.code::join(qenv_final, qq_q()) + c(qenv_final, qq_q()) } qenv_final }) diff --git a/R/tm_g_response.R b/R/tm_g_response.R index 44daa300d..a593c46a4 100644 --- a/R/tm_g_response.R +++ b/R/tm_g_response.R @@ -39,10 +39,12 @@ #' @note For more examples, please see the vignette "Using response plot" via #' `vignette("using-response-plot", package = "teal.modules.general")`. #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} #' @examples #' # general data example -#' library(teal.widgets) -#' #' data <- teal_data() #' data <- within(data, { #' require(nestcolor) @@ -51,7 +53,6 @@ #' mtcars[[v]] <- as.factor(mtcars[[v]]) #' } #' }) -#' datanames(data) <- "mtcars" #' #' app <- init( #' data = data, @@ -77,9 +78,6 @@ #' multiple = FALSE, #' fixed = FALSE #' ) -#' ), -#' ggplot2_args = ggplot2_args( -#' labs = list(subtitle = "Plot generated by Response Module") #' ) #' ) #' ) @@ -88,16 +86,18 @@ #' shinyApp(app$ui, app$server) #' } #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +#' @examples #' # CDISC data example -#' library(teal.widgets) -#' #' data <- teal_data() #' data <- within(data, { #' require(nestcolor) #' ADSL <- rADSL #' }) -#' datanames(data) <- c("ADSL") -#' join_keys(data) <- default_cdisc_join_keys[datanames(data)] +#' join_keys(data) <- default_cdisc_join_keys[names(data)] #' #' app <- init( #' data = data, @@ -123,9 +123,6 @@ #' multiple = FALSE, #' fixed = FALSE #' ) -#' ), -#' ggplot2_args = ggplot2_args( -#' labs = list(subtitle = "Plot generated by Response Module") #' ) #' ) #' ) diff --git a/R/tm_g_scatterplot.R b/R/tm_g_scatterplot.R index 283c6cb5b..696ff4eb6 100644 --- a/R/tm_g_scatterplot.R +++ b/R/tm_g_scatterplot.R @@ -30,16 +30,19 @@ #' #' @inherit shared_params return #' -#' @examples -#' library(teal.widgets) -#' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +# nolint start: line_length_linter. +#' @examplesIf require("ggpmisc", quietly = TRUE) && require("ggExtra", quietly = TRUE) && require("colourpicker", quietly = TRUE) +# nolint end: line_length_linter. #' # general data example #' data <- teal_data() #' data <- within(data, { #' require(nestcolor) #' CO2 <- CO2 #' }) -#' datanames(data) <- "CO2" #' #' app <- init( #' data = data, @@ -108,9 +111,6 @@ #' multiple = FALSE, #' fixed = FALSE #' ) -#' ), -#' ggplot2_args = ggplot2_args( -#' labs = list(subtitle = "Plot generated by Scatterplot Module") #' ) #' ) #' ) @@ -119,14 +119,20 @@ #' shinyApp(app$ui, app$server) #' } #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +# nolint start: line_length_linter. +#' @examplesIf require("ggpmisc", quietly = TRUE) && require("ggExtra", quietly = TRUE) && require("colourpicker", quietly = TRUE) +# nolint end: line_length_linter. #' # CDISC data example #' data <- teal_data() #' data <- within(data, { #' require(nestcolor) #' ADSL <- rADSL #' }) -#' datanames(data) <- c("ADSL") -#' join_keys(data) <- default_cdisc_join_keys[datanames(data)] +#' join_keys(data) <- default_cdisc_join_keys[names(data)] #' #' app <- init( #' data = data, @@ -195,9 +201,6 @@ #' multiple = FALSE, #' fixed = FALSE #' ) -#' ), -#' ggplot2_args = ggplot2_args( -#' labs = list(subtitle = "Plot generated by Scatterplot Module") #' ) #' ) #' ) diff --git a/R/tm_g_scatterplotmatrix.R b/R/tm_g_scatterplotmatrix.R index 2f857afcc..89fa86935 100644 --- a/R/tm_g_scatterplotmatrix.R +++ b/R/tm_g_scatterplotmatrix.R @@ -18,7 +18,11 @@ #' #' @inherit shared_params return #' -#' @examples +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +#' @examplesIf require("lattice", quietly = TRUE) #' # general data example #' data <- teal_data() #' data <- within(data, { @@ -52,7 +56,6 @@ #' profit = rnorm(50, 20, 10) #' ) #' }) -#' datanames(data) <- c("countries", "sales") #' join_keys(data) <- join_keys( #' join_key("countries", "countries", "id"), #' join_key("sales", "sales", "id"), @@ -102,14 +105,18 @@ #' shinyApp(app$ui, app$server) #' } #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +#' @examplesIf require("lattice", quietly = TRUE) #' # CDISC data example #' data <- teal_data() #' data <- within(data, { #' ADSL <- rADSL #' ADRS <- rADRS #' }) -#' datanames(data) <- c("ADSL", "ADRS") -#' join_keys(data) <- default_cdisc_join_keys[datanames(data)] +#' join_keys(data) <- default_cdisc_join_keys[names(data)] #' #' app <- init( #' data = data, diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index efa832bdb..079a87718 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -17,19 +17,11 @@ #' #' @inherit shared_params return #' -#' @examples -#' library(teal.widgets) -#' -#' # module specification used in apps below -#' tm_missing_data_module <- tm_missing_data( -#' ggplot2_args = list( -#' "Combinations Hist" = ggplot2_args( -#' labs = list(subtitle = "Plot produced by Missing Data Module", caption = NULL) -#' ), -#' "Combinations Main" = ggplot2_args(labs = list(title = NULL)) -#' ) -#' ) -#' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +#' @examplesIf require("gridExtra", quietly = TRUE) && require("rlang", quietly = TRUE) #' # general example data #' data <- teal_data() #' data <- within(data, { @@ -48,16 +40,22 @@ #' mtcars[["cyl"]] <- as.factor(mtcars[["cyl"]]) #' mtcars[["gear"]] <- as.factor(mtcars[["gear"]]) #' }) -#' datanames(data) <- c("iris", "mtcars") #' #' app <- init( #' data = data, -#' modules = modules(tm_missing_data_module) +#' modules = modules( +#' tm_missing_data() +#' ) #' ) #' if (interactive()) { #' shinyApp(app$ui, app$server) #' } #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +#' @examplesIf require("gridExtra", quietly = TRUE) && require("rlang", quietly = TRUE) #' # CDISC example data #' data <- teal_data() #' data <- within(data, { @@ -65,12 +63,13 @@ #' ADSL <- rADSL #' ADRS <- rADRS #' }) -#' datanames(data) <- c("ADSL", "ADRS") -#' join_keys(data) <- default_cdisc_join_keys[datanames(data)] +#' join_keys(data) <- default_cdisc_join_keys[names(data)] #' #' app <- init( #' data = data, -#' modules = modules(tm_missing_data_module) +#' modules = modules( +#' tm_missing_data() +#' ) #' ) #' if (interactive()) { #' shinyApp(app$ui, app$server) @@ -164,10 +163,11 @@ srv_page_missing_data <- function(id, data, reporter, filter_panel_api, parent_d moduleServer(id, function(input, output, session) { teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general") - datanames <- isolate(teal.data::datanames(data())) - datanames <- Filter(function(name) { - is.data.frame(isolate(data())[[name]]) - }, datanames) + datanames <- isolate(names(data())) + datanames <- Filter( + function(name) is.data.frame(isolate(data())[[name]]), + datanames + ) if_subject_plot <- length(parent_dataname) > 0 && parent_dataname %in% datanames ns <- session$ns @@ -456,8 +456,8 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par data_parent_keys <- reactive({ - if (length(parent_dataname) > 0 && parent_dataname %in% names(data)) { - keys <- teal.data::join_keys(data)[[dataname]] + if (length(parent_dataname) > 0 && parent_dataname %in% names(data())) { + keys <- teal.data::join_keys(data())[[dataname]] if (parent_dataname %in% names(keys)) { keys[[parent_dataname]] } else { diff --git a/R/tm_outliers.R b/R/tm_outliers.R index 7f30b897a..dab983f2d 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -17,16 +17,17 @@ #' #' @inherit shared_params return #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} #' @examples -#' library(teal.widgets) -#' #' # general data example #' data <- teal_data() #' data <- within(data, { #' CO2 <- CO2 #' CO2[["primary_key"]] <- seq_len(nrow(CO2)) #' }) -#' datanames(data) <- "CO2" #' join_keys(data) <- join_keys(join_key("CO2", "CO2", "primary_key")) #' #' vars <- choices_selected(variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment"))) @@ -57,11 +58,6 @@ #' multiple = TRUE #' ) #' ) -#' ), -#' ggplot2_args = list( -#' ggplot2_args( -#' labs = list(subtitle = "Plot generated by Outliers Module") -#' ) #' ) #' ) #' ) @@ -70,13 +66,17 @@ #' shinyApp(app$ui, app$server) #' } #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +#' @examples #' # CDISC data example #' data <- teal_data() #' data <- within(data, { #' ADSL <- rADSL #' }) -#' datanames(data) <- "ADSL" -#' join_keys(data) <- default_cdisc_join_keys[datanames(data)] +#' join_keys(data) <- default_cdisc_join_keys[names(data)] #' #' fact_vars_adsl <- names(Filter(isTRUE, sapply(data[["ADSL"]], is.factor))) #' vars <- choices_selected(variable_choices(data[["ADSL"]], fact_vars_adsl)) @@ -107,11 +107,6 @@ #' multiple = TRUE #' ) #' ) -#' ), -#' ggplot2_args = list( -#' ggplot2_args( -#' labs = list(subtitle = "Plot generated by Outliers Module") -#' ) #' ) #' ) #' ) @@ -399,7 +394,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, }) # Used to create outlier table and the dropdown with additional columns - dataname_first <- isolate(teal.data::datanames(data())[[1]]) + dataname_first <- isolate(names(data())[[1]]) common_code_q <- reactive({ req(iv_r()$is_valid()) @@ -964,7 +959,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, substitute( expr = { columns_index <- union( - setdiff(names(ANL_OUTLIER), "is_outlier_selected"), + setdiff(names(ANL_OUTLIER), c("is_outlier_selected", "order")), table_columns ) ANL_OUTLIER_EXTENDED[ANL_OUTLIER_EXTENDED$is_outlier_selected, columns_index] diff --git a/R/tm_t_crosstable.R b/R/tm_t_crosstable.R index d4e3b4700..47d84bcfd 100644 --- a/R/tm_t_crosstable.R +++ b/R/tm_t_crosstable.R @@ -25,10 +25,12 @@ #' #' @inherit shared_params return #' -#' @examples +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +#' @examplesIf require("rtables", quietly = TRUE) #' # general data example -#' library(teal.widgets) -#' #' data <- teal_data() #' data <- within(data, { #' mtcars <- mtcars @@ -37,7 +39,6 @@ #' } #' mtcars[["primary_key"]] <- seq_len(nrow(mtcars)) #' }) -#' datanames(data) <- "mtcars" #' join_keys(data) <- join_keys(join_key("mtcars", "mtcars", "primary_key")) #' #' app <- init( @@ -65,9 +66,6 @@ #' multiple = FALSE, #' fixed = FALSE #' ) -#' ), -#' basic_table_args = basic_table_args( -#' subtitles = "Table generated by Crosstable Module" #' ) #' ) #' ) @@ -76,15 +74,17 @@ #' shinyApp(app$ui, app$server) #' } #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +#' @examplesIf require("rtables", quietly = TRUE) #' # CDISC data example -#' library(teal.widgets) -#' #' data <- teal_data() #' data <- within(data, { #' ADSL <- rADSL #' }) -#' datanames(data) <- "ADSL" -#' join_keys(data) <- default_cdisc_join_keys[datanames(data)] +#' join_keys(data) <- default_cdisc_join_keys[names(data)] #' #' app <- init( #' data = data, @@ -117,9 +117,6 @@ #' multiple = FALSE, #' fixed = FALSE #' ) -#' ), -#' basic_table_args = basic_table_args( -#' subtitles = "Table generated by Crosstable Module" #' ) #' ) #' ) diff --git a/R/tm_variable_browser.R b/R/tm_variable_browser.R index 6177946d7..b6837157c 100644 --- a/R/tm_variable_browser.R +++ b/R/tm_variable_browser.R @@ -21,17 +21,13 @@ #' #' @inherit shared_params return #' -#' @examples -#' library(teal.widgets) -#' -#' # Module specification used in apps below -#' tm_variable_browser_module <- tm_variable_browser( -#' label = "Variable browser", -#' ggplot2_args = ggplot2_args( -#' labs = list(subtitle = "Plot generated by Variable Browser Module") -#' ) -#' ) -#' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +# nolint start: line_length_linter. +#' @examplesIf require("sparkline", quietly = TRUE) && require("htmlwidgets", quietly = TRUE) && require("jsonlite", quietly = TRUE) +# nolint end: line_length_linter. #' # general data example #' data <- teal_data() #' data <- within(data, { @@ -41,28 +37,42 @@ #' faithful <- faithful #' CO2 <- CO2 #' }) -#' datanames(data) <- c("iris", "mtcars", "women", "faithful", "CO2") #' #' app <- init( #' data = data, -#' modules = modules(tm_variable_browser_module) +#' modules = modules( +#' tm_variable_browser( +#' label = "Variable browser" +#' ) +#' ) #' ) #' if (interactive()) { #' shinyApp(app$ui, app$server) #' } #' +#' @examplesShinylive +#' library(teal.modules.general) +#' interactive <- function() TRUE +#' {{ next_example }} +# nolint start: line_length_linter. +#' @examplesIf require("sparkline", quietly = TRUE) && require("htmlwidgets", quietly = TRUE) && require("jsonlite", quietly = TRUE) +# nolint end: line_length_linter. #' # CDISC example data +#' library(sparkline) #' data <- teal_data() #' data <- within(data, { #' ADSL <- rADSL #' ADTTE <- rADTTE #' }) -#' datanames(data) <- c("ADSL", "ADTTE") -#' join_keys(data) <- default_cdisc_join_keys[datanames(data)] +#' join_keys(data) <- default_cdisc_join_keys[names(data)] #' #' app <- init( #' data = data, -#' modules = modules(tm_variable_browser_module) +#' modules = modules( +#' tm_variable_browser( +#' label = "Variable browser" +#' ) +#' ) #' ) #' if (interactive()) { #' shinyApp(app$ui, app$server) @@ -211,7 +221,7 @@ srv_variable_browser <- function(id, varname_numeric_as_factor <- reactiveValues() - datanames <- isolate(teal.data::datanames(data())) + datanames <- isolate(names(data())) datanames <- Filter(function(name) { is.data.frame(isolate(data())[[name]]) }, datanames) @@ -905,9 +915,9 @@ render_tab_header <- function(dataset_name, output, data) { dataset_ui_id <- paste0("dataset_summary_", dataset_name) output[[dataset_ui_id]] <- renderText({ df <- data()[[dataset_name]] - join_keys <- join_keys(data()) + join_keys <- teal.data::join_keys(data()) if (!is.null(join_keys)) { - key <- join_keys(data())[dataset_name, dataset_name] + key <- teal.data::join_keys(data())[dataset_name, dataset_name] } else { key <- NULL } @@ -977,7 +987,7 @@ render_tab_table <- function(dataset_name, parent_dataname, output, data, input, # get icons proper for the data types icons <- vapply(df, function(x) class(x)[1L], character(1L)) - join_keys <- join_keys(data()) + join_keys <- teal.data::join_keys(data()) if (!is.null(join_keys)) { icons[intersect(join_keys[dataset_name, dataset_name], colnames(df))] <- "primary_key" } diff --git a/README.md b/README.md index ef66a1ece..b60732686 100644 --- a/README.md +++ b/README.md @@ -41,26 +41,26 @@ Please see [`teal` gallery](https://github.com/insightsengineering/teal.gallery) ## Installation ```r -# stable versions install.packages('teal.modules.general') - -# install.packages("pak") -pak::pak("insightsengineering/teal.modules.general@*release") ``` -Alternatively, you might want to use the development version available on [r-universe](https://r-universe.dev/). +Alternatively, you might want to use the development version. ```r -# beta versions -install.packages('teal.modules.general', repos = c('https://pharmaverse.r-universe.dev', getOption('repos'))) - # install.packages("pak") pak::pak("insightsengineering/teal.modules.general") ``` ## Usage -See package vignettes `browseVignettes(package = "teal.modules.general")` for usage of this package or visit [Package Website](https://insightsengineering.github.io/teal.modules.general/latest-tag/). +To understand how to use this package, please refer to the [Getting Started](https://insightsengineering.github.io/teal.modules.general/latest-tag/articles/teal-modules-general.html) article, which provides multiple examples of code implementation. + +## Playground + +You can try out the package without installing it in the Shinylive: + +* [stable](https://shinylive.io/r/editor/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCGAC+AXSA) +* [development](https://shinylive.io/r/editor/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMI1UgSxIGcAKAdzgCMAnAfVQGsA5jy5xURRgAIAvJILMAOmC4BaAK4Q6ANzhdGcJTMlKAFqVKpGiAPTXUJqFxhQdeuBlUbtu-RgAmcFpKuJKCcKQA8rQMEIpg7Nx8QiJiEkoAlJkKEAA2dNyOAJ7M5FA5GDBEfmo5cIwYYRC6ZenZYAC+ALpAA) ## Getting help diff --git a/_pkgdown.yml b/_pkgdown.yml index ec36b1c74..d8d697150 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -15,6 +15,8 @@ navbar: href: coverage-report/ - text: Unit test report href: unit-test-report/ + - text: Non-CRAN unit test report + href: unit-test-report-non-cran/ github: icon: fa-github href: https://github.com/insightsengineering/teal.modules.general diff --git a/inst/WORDLIST b/inst/WORDLIST index e77494d7b..d00a0162f 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,6 +1,7 @@ Forkers Hoffmann Prebuilt +Shinylive TLG UI customizable diff --git a/man/tm_a_pca.Rd b/man/tm_a_pca.Rd index a4fa1e679..ac4f506ba 100644 --- a/man/tm_a_pca.Rd +++ b/man/tm_a_pca.Rd @@ -83,8 +83,6 @@ Additionally, it enables dynamic customization of plot aesthetics, such as opaci font size, through UI inputs. } \examples{ -library(teal.widgets) - # general data example data <- teal_data() data <- within(data, { @@ -92,8 +90,6 @@ data <- within(data, { USArrests <- USArrests }) -datanames(data) <- "USArrests" - app <- init( data = data, modules = modules( @@ -109,9 +105,6 @@ app <- init( multiple = TRUE ), filter = NULL - ), - ggplot2_args = ggplot2_args( - labs = list(subtitle = "Plot generated by PCA Module") ) ) ) @@ -126,8 +119,7 @@ data <- within(data, { require(nestcolor) ADSL <- rADSL }) -datanames(data) <- "ADSL" -join_keys(data) <- default_cdisc_join_keys[datanames(data)] +join_keys(data) <- default_cdisc_join_keys[names(data)] app <- init( data = data, @@ -144,9 +136,6 @@ app <- init( multiple = TRUE ), filter = NULL - ), - ggplot2_args = ggplot2_args( - labs = list(subtitle = "Plot generated by PCA Module") ) ) ) @@ -156,3 +145,18 @@ if (interactive()) { } } +\section{Examples in Shinylive}{ +\describe{ + \item{example-1}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXVIhrqu-lCkULpwAB6wqCJKAUEGxlzUAPoxUDbRgcFGugDutKQAFirsKbi6IEq6uoxwAI6CtNXsPqKkxNREjIoQlY4AygCCjNUtonG6fYPDpKJKAL5dSmioYyp57BX+GboAvJtBuBt8QiKju0fCYuvdlbqkMIlQiagEqRs3ugpgAAoAwv2fB2u7xiOz2jzCpGYGkSolQcAIV3ewIy0HgoM+EyGYmmALeSNEcBEGlBBKJpBhcIReKRugI+SItAIYlBWhYtCg9BEiTpDKZokRNKRKVBKWAwAxAyxI0+AF0ZaUqWAALKCRj8GQAj5gfqiURQYSkTUYxj0KAQL5EVBGsBYNBwT5dQU3OSAp2VUnw8j8UGKlVqjV4LU6vUGh2ut0wA20SJ6XYOFzU53hmkmWjUciMUEAOUcABlc4nHc6Nl0urQTLp2CoM+pNDobLZytdRIUIKx+uh2EsACT1Uo9gmMHSdOZKMCzGVAA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } + \item{example-2}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXQGEAIgEkAZS9dfihSKF04AA9YVBElUPCDYy5qAH1EqBsEsIijXQB3WlIACxV2TNxdECVdXUY4AEdBWgb2CDFSYmoiRkUIOoBBHwCAGWT64bGlAF9+gCsiFTSAazhWUQrc23z+OBMoYVI0gn5aUQI0xeW1jeBoeE3MuQBdN2h0CZVi9lqQ3N0AF5-uFcH8+EIRKIgboIcIxL8BnVdKQYGkoGlUAQsn9kboFGAAApeQYEsFIvGJGGZNLRUjMDRpUSoOAERF4ym5B56YEEqajMm4jmiOAiDQwkVi47M1nsjl4gglJYEMQwrQsWhQegiE5K2gqzZC+V1TLU3LAYB8kYCsAvF5VNkEgBCAFksABpLAARjJ+LAgwA4q48H7nAB5AI+ACaBP6xuRcnJ8bqktZ5H4MMdYFdHu9vr5QdjSeTMCOtDiPPsTlcFI5iaNyJMtGo5EYMIAco5RgLa3U4wm-v1+rQTLp2CpW+pNDobLYakjRGUIKxBuh2GhUAASFpVDebkWMHR9WZKMAzF5AA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } +} +} + diff --git a/man/tm_a_regression.Rd b/man/tm_a_regression.Rd index dc4f458f3..85b3c578d 100644 --- a/man/tm_a_regression.Rd +++ b/man/tm_a_regression.Rd @@ -112,14 +112,11 @@ For more examples, please see the vignette "Using regression plots" via } \examples{ # general data example -library(teal.widgets) - data <- teal_data() data <- within(data, { require(nestcolor) CO2 <- CO2 }) -datanames(data) <- c("CO2") app <- init( data = data, @@ -145,9 +142,6 @@ app <- init( multiple = TRUE, fixed = FALSE ) - ), - ggplot2_args = ggplot2_args( - labs = list(subtitle = "Plot generated by Regression Module") ) ) ) @@ -157,15 +151,12 @@ if (interactive()) { } # CDISC data example -library(teal.widgets) - data <- teal_data() data <- within(data, { require(nestcolor) ADSL <- rADSL }) -datanames(data) <- "ADSL" -join_keys(data) <- default_cdisc_join_keys[datanames(data)] +join_keys(data) <- default_cdisc_join_keys[names(data)] app <- init( data = data, @@ -191,9 +182,6 @@ app <- init( multiple = TRUE, fixed = FALSE ) - ), - ggplot2_args = ggplot2_args( - labs = list(subtitle = "Plot generated by Regression Module") ) ) ) @@ -203,3 +191,18 @@ if (interactive()) { } } +\section{Examples in Shinylive}{ +\describe{ + \item{example-1}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXVIhrqu-lCkULpwAB6wqCJKAUEGxlzUAPoxUDbRgcFGugDutKQAFirsKbi6IEq6uoxwAI6CtNXsPqKkxNREjIoQlQDCAPIATHG6-QNKAL5dSmiowyp57BX+GboAvMtBuEt8QiKia7o7wmKL3ZW6pDCJUInVEtWiolYQp+fn1FD0cH7rCmBYcHuYieJD+WzObweqBIoj06xSiTCpGYGkSolQcAIrze5xS0HgBz+ozBSxxulhIg0BwpmNIaIxWNJZN0Hy+P10fwAyt9abotCxaJ8RIgSRDmQR8kRaAQxISwIJUEEANZwUXM840jRwfhyhXK1V4JlkmDCTSROG6ABiAEEADKc5zg9WVEy0ULag4OFxG85dMlyJ04u4PUQdA4IpEounozHYsl42AWomDNXMzWkak81Exxlisms75y7mUjP8xiC+h7EWGvM4iVSmX7dZlisiRL16UnFLAYDJsZgAC6A9KjMIJAIYI5YDs1UC8DIfzkAZ9b3THt+Y4sqfVJuoZpEnqcjpX51d7p16xt9tctcqfpx97vSy6XVoJl07BU5Cj2jgNls5RnKIhQQKw1roOwMwACT1KU0GwowOidBMShgOMA5AA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } + \item{example-2}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXQGEAIgEkAZS9dfihSKF04AA9YVBElUPCDYy5qAH1EqBsEsIijXQB3WlIACxV2TNxdECVdXUY4AEdBWgb2CDFSYmoiRkUIOoBBHwCAGWT64bGlAF9+gCsiFTSAazhWUQrc23z+OBMoYVI0gn5aUQI0xeW1jeBoeE3MuQBdN2h0CZVi9lqQ3N0AF5-uFcH8+EIRKIgboIcIxL8BnVdKQYGkoGkGhIGqJRFYIIjkcjqFB6HBqDCFGAsHBsWI8SQqWCkUScagSKI9MDMmloqRmBo0qJUHACISicjMg8uboqVNRky-hLdJyRBoYarRcdhaLxcq6iSyRTgVSAuStbotCxaKSRIhFSz9QQSksCGJKWAAEIAWSwAGksABGB365GajRwfgen3+oMh0Owo60OIygBig1GAWczITploUUjMIcLiVEv6yrkOYlWJxol6MJ5fIF2pFYtLRKlsBlcpGCrw7bD5vVwPDLd1A6JhvJHrNatIluttrE9v7juVztd7uBVsYNvoIhOLtobqeuWAwB70zALxeVTbYEGAHFXHhZWAswANJlvrCDLwvuRKwnQc50LE0H2feNQxgJMUyLJxs2AuoTHzMDdHTTNXDXZFyzLUtcP6fpaBMXR2BUchm20OAbFsGokVEMoIFYQZ0HYNBUAAEhaKp2I4zlGB0PpZiUMAZheIA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } +} +} + diff --git a/man/tm_data_table.Rd b/man/tm_data_table.Rd index 1d24f04b1..3d105c6c0 100644 --- a/man/tm_data_table.Rd +++ b/man/tm_data_table.Rd @@ -68,7 +68,6 @@ data <- within(data, { require(nestcolor) iris <- iris }) -datanames(data) <- c("iris") app <- init( data = data, @@ -91,8 +90,7 @@ data <- within(data, { require(nestcolor) ADSL <- rADSL }) -datanames(data) <- "ADSL" -join_keys(data) <- default_cdisc_join_keys[datanames(data)] +join_keys(data) <- default_cdisc_join_keys[names(data)] app <- init( data = data, @@ -108,3 +106,18 @@ if (interactive()) { } } +\section{Examples in Shinylive}{ +\describe{ + \item{example-1}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXVIhrqu-lCkULpwAB6wqCJKAUEGxlzUAPoxUDbRgcFGugDutKQAFirsKbi6IEq6uoxwAI6CtNXsPqKkxNREjIoQlQ20onG6vaJKAL5dSmioAyp57BX+GboAvAtBuPN8QiL9K5vCYnPdlbqkMMkZiUH0IofHx1ostFDXYomicCIacPzLunQttzuxyGvwIczAAGU4KhuBgADIUCQFBR4XQoqEwngAdVo-GRqJRAAU4EEeAiIEj8ijSkSSbCcXiqQTIag4ARaGIUV0gbo5Osjnc8YkWBIdn8+qR2AQ0JoSL8UQBJLAKiH2Z4iXQAYRlVggXPmlW5vKUXVoJl07BU5GYlh0Nls5SOokKEFYAEF0OxJgASeqlH3vRg6TqjJRgEYAXSAA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } + \item{example-2}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXQGEAIgEkAZS9dfihSKF04AA9YVBElUPCDYy5qAH1EqBsEsIijXQB3WlIACxV2TNxdECVdXUY4AEdBWgb2CDFSYmoiRkUIOoBBHwCAGWT64bGlAF9+gCsiFTSAazhWUQrc23z+OBMoYVI0gn5aUQI0xeW1jeBoeE3MuQBdN2h0CZVi9lqQ3N0AF5-uFcH8+EIRKIgboIcIxL8BnVdKQYBlcmlwvQRIjkcitCxaFBsWI0qI4CINHB+DC6KJSOwpuNgQRfmAAnZHD4AJp+HwKPC6AWOAKOABCACk+QKqgLRZLpYK5X47M5FbKwIMAOKuJXs5wADQFcjkYKReP4xxYEmhwLpDIIaE0JBhAqZ9mJIm8TqsEGNfzq-UDSn6tBMunYKnIzEsOhsthqSNEZQgrEG6HYaFQABIWlUs9nyYwdH1ZkowDMXkA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } +} +} + diff --git a/man/tm_file_viewer.Rd b/man/tm_file_viewer.Rd index c04f73a2e..cf3b5cdd3 100644 --- a/man/tm_file_viewer.Rd +++ b/man/tm_file_viewer.Rd @@ -31,7 +31,6 @@ data <- teal_data() data <- within(data, { data <- data.frame(1) }) -datanames(data) <- c("data") app <- init( data = data, @@ -51,3 +50,13 @@ if (interactive()) { } } +\section{Examples in Shinylive}{ +\describe{ + \item{example-1}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqX8opKAeNdqAfQ8vG3dPbyNdAHdaUgALFXYgqFxdECVdXSSfTLCME2Z4dgBGRQgAX1KlNFRslRj2dJyvXQBeJuTGviERUVbdLuExBogMjNIYfxNaEX8tWjhImWHR0ZVUQVJ-VE9YvrpRUmWV0ZMian4ZPtFWA7gYPOm4BrBRWFQZqZ6FPF1tggBrKBSPrfPy8ASDcRSCBqajfOS4RrHX4QCRXG7ke6fJ7fV4wd5wSaPUQAejxBKJIgwqFR3xSf0BwLaoLg3HB3TEkmksnhiJGyN0pAAHqR0bcsY9nuSPsSyW8ZVThaQ6b91Iy9MywGCBj0uTCeWAEUjjoJGNQQWBYqRSKhRIgSSSTB5JEQtI7ZfxGIIJKT1vR9rE4PwSQAFIiMLz+uCGAAiRAIgngZEMADFwzBPIYAMqoOAEWhTAieKwQcSofgmb7GjKlFa13SlUoF3TsFTkZiWHQ2WxpfmieIQVgAQXQ7GqABJBLQUhPRDIdIxSmUlGAygBdIA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } +} +} + diff --git a/man/tm_front_page.Rd b/man/tm_front_page.Rd index 801bbd00e..35b1c3e9d 100644 --- a/man/tm_front_page.Rd +++ b/man/tm_front_page.Rd @@ -46,8 +46,7 @@ data <- within(data, { ADSL <- rADSL attr(ADSL, "metadata") <- list("Author" = "NEST team", "data_source" = "synthetic data") }) -datanames(data) <- "ADSL" -join_keys(data) <- default_cdisc_join_keys[datanames(data)] +join_keys(data) <- default_cdisc_join_keys[names(data)] table_1 <- data.frame(Info = c("A", "B"), Text = c("A", "B")) table_2 <- data.frame(`Column 1` = c("C", "D"), `Column 2` = c(5.5, 6.6), `Column 3` = c("A", "B")) @@ -82,3 +81,13 @@ if (interactive()) { } } +\section{Examples in Shinylive}{ +\describe{ + \item{example-1}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqX8opKAeNdqAfQ8vG3dPbyNdAHdaUgALFXYgqFxdECVdXUY4AEdBWiz2CDFSYmoiRkUIDIBBABEAZQAZH0y6pvTdT1JGdjbGlIUweC8kwdsIulFSdkHqwTjywd0AXl1BgDlnertdLhhBgbAk-1EiQUYCOCXVwdFWMli4TQJdUbBKgF9KgCsiFX8ANZwViiRJhcbGfhwExQYSkfwEfi0UQEfy-f5AkHAaDwUFJOQAXTcZCg9BE-gAjC0khgTMx4OwAJIQExEFa6AgzMDVA5rMAAITGKTscAAHqR2ZzZrzBoL3pUvGS4P4AEzUsK0+lwdgAAwAwkRqIIYFUKTrJVy9TKwLUhbp9YbjVUVebVpyAKwYd0pABsGB9chSDqNJt0AGZXRyuTy8Hy5XIFaTyWH1V5NbBtczWRbBq5Y4MAGJ2kXinNgADi1oAEmNKkpFeSVKh5i1JtMOoM7Em9BTrrtu5TcB2wF2lboVX2G8qVUOqnzRyJw5OB2GlHXoOgWioYjM50l2UlZxk+EIRKJ2SfhGJdxkMqQYP46SR4agoFIb7eMo8oFDGP5yKWbofp+GSDIyMCoOUXhkLoKisowMCeFYEB9mBEoEFAVQSGyjxZBgBwdCBfIAPJxDIsEsuUiGaCQqFgHqmG6Nhui4XA+FgIRt6Bpxd7dueqxTv4TbzEeIE-kiNHQAEXgSPxuhVnYACyjTRvwEnIdw8lKc05S6KI8QQKw-ayUxOEyHo+hMAAfEKPGmEQRCkBAjliGWAAadHIrsjymPkUz2Y5znkNaACasHnmRelwMQED8AFTkubZc6fvpRCRP4ww-mE7IOC4nGVBk3Fzt+v7sjJogACSxBSXL1LAqCLtU6B0BhklJRkrIuYwZVvpVqDRs1tCtch8UyEl660CYujsCo5DMJYOg2LYaRzvpKisE1-VoKgFV5Ck20VaIMg6BUSgfEoYAfASQA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } +} +} + diff --git a/man/tm_g_association.Rd b/man/tm_g_association.Rd index ef47169a7..c239f6051 100644 --- a/man/tm_g_association.Rd +++ b/man/tm_g_association.Rd @@ -71,8 +71,6 @@ For more examples, please see the vignette "Using association plot" via \code{vignette("using-association-plot", package = "teal.modules.general")}. } \examples{ -library(teal.widgets) - # general data example data <- teal_data() data <- within(data, { @@ -81,7 +79,6 @@ data <- within(data, { factors <- names(Filter(isTRUE, vapply(CO2, is.factor, logical(1L)))) CO2[factors] <- lapply(CO2[factors], as.character) }) -datanames(data) <- c("CO2") app <- init( data = data, @@ -105,9 +102,6 @@ app <- init( multiple = TRUE, fixed = FALSE ) - ), - ggplot2_args = ggplot2_args( - labs = list(subtitle = "Plot generated by Association Module") ) ) ) @@ -122,8 +116,7 @@ data <- within(data, { require(nestcolor) ADSL <- rADSL }) -datanames(data) <- "ADSL" -join_keys(data) <- default_cdisc_join_keys[datanames(data)] +join_keys(data) <- default_cdisc_join_keys[names(data)] app <- init( data = data, @@ -153,9 +146,6 @@ app <- init( multiple = TRUE, fixed = FALSE ) - ), - ggplot2_args = ggplot2_args( - labs = list(subtitle = "Plot generated by Association Module") ) ) ) @@ -165,3 +155,18 @@ if (interactive()) { } } +\section{Examples in Shinylive}{ +\describe{ + \item{example-1}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXVIhrqu-lCkULpwAB6wqCJKAUEGxlzUAPoxUDbRgcFGugDutKQAFirsKbi6IEq6uoxwAI6CtNXsPqKkxNREjIoQlQDCAPIATHG6-QMVpuqkHaLD0PCi7ABitNTkjOy0og4upVpokRyjpZsYJpMdpe0StATc7ACMADJyL129g8BnGtMAusPU+2ohw+XymjFEP1KUHEBHyLEmMi6AF8ukp9sMVHl2OMUroALz+DK4cZ8IQiGYE0nCMTY7qVXSkGCJCSJaGiIgEWiBKwQWn0+nVEz4wlBRJhUjMDSJUSoOAEPn8+kpOZ6AkKMCjdXEumK3SiOAiDTC-WG0jS2Xy8a6yoA+gG4XqgDKBrlpF0e0YXPoIkQWqt1thRBuYmFHq9IkSgeDCxSwGA6s1YB+kN0lrAAAUAWQtbp1XZWLKc3nqoF4NmwC9tdb6SbXXB+A6M1nSH6ddaTLRQvXhYsAIKPR2uNv8t6KuRVxUeikiqBi0ISybmuUK3XK2Cq3Mawat6u1o0EvdmmXL-26232tVgZ2m90scNiX14U+KqMEEMEsNQb1wSP5INvmMMjjBNtyTFM00zKBy1KPMCzgIswDsEtGQoFsK3HZ9+UPbtLyQuBS1Qndq10GBhE0SIN22ZwJ2rDsuwbAk+wHIdq1HEd-VHLouloIUNlUSVNB0GxbHKOlREKCBWF7dB2H2AASeooXQOT9UYHROiUJElDAJEfiAA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } + \item{example-2}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXQGEAIgEkAZS9dfihSKF04AA9YVBElUPCDYy5qAH1EqBsEsIijXQB3WlIACxV2TNxdECVdXUY4AEdBWgb2CDFSYmoiRkUIOoBBHwCAGWT64bGlAF9+gCsiFTSAazhWUQrc23z+OBMoYVI0gn5aUQI0xeW1jeBoeE3MuQBdN2h0CZVi9lqQ3N0AF5-uFcH8+EIRKIgboIcIxL8BnVdKQYGkJGkoKJREQCLQwlYIIjkciGiYYZk0tFSMwNGlRKg4ARiSTkZkHnpgQowFNRtywUjWbpRHARBoYSKxccGUyWUK6tQoPRRTDuQFRUzSLotCx8fQRIh+X95boCCUlgQxDCdYw9SITubaJbNsaTSCoMBgNzedyXi8BW7kcy1c4ABr83TcrCDLyuPCRsBeADyjgAcg4AJoR71YACy2bAAQcgzsgwAjAWi9HSwAmAt+Ox2ABifPj3IAQrmsABpLB1sD9QNyANuyWauD8VVgaOxo2C+UmWhRCcwpuDUYBVzzkmD1nD111G3Q4GU6m06WM4Pbtm5DlTn14A-Isfi4Evi+yp8kxXK6hT9VStqupKlChqPteJJmhaVrAjadpwA60EuhBrKZJ63ojK2fojoGwaFmGBYznGVTcsmaaZgWgx5pWxalhWbaFrRgz9iRYANs2rasZ2PZ9tyu4mvuKF1O+K5cmA3G9ixX7IjARy0HEnL2E4zg4QuS6iboa4bluAlPvxui7v0-S0OS7AqOQ57aHANi2DUSKiGUECsIM6DsGgqAACQtFU7keSKjA6H0sxKGAMwvEAA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } +} +} + diff --git a/man/tm_g_bivariate.Rd b/man/tm_g_bivariate.Rd index fc0675ee3..cce2711a0 100644 --- a/man/tm_g_bivariate.Rd +++ b/man/tm_g_bivariate.Rd @@ -116,15 +116,12 @@ For more examples, please see the vignette "Using bivariate plot" via \code{vignette("using-bivariate-plot", package = "teal.modules.general")}. } \examples{ -library(teal.widgets) - # general data example data <- teal_data() data <- within(data, { require(nestcolor) CO2 <- data.frame(CO2) }) -datanames(data) <- c("CO2") app <- init( data = data, @@ -165,9 +162,6 @@ app <- init( selected = "Treatment", fixed = FALSE ) - ), - ggplot2_args = ggplot2_args( - labs = list(subtitle = "Plot generated by Bivariate Module") ) ) ) @@ -175,15 +169,13 @@ if (interactive()) { shinyApp(app$ui, app$server) } - # CDISC data example data <- teal_data() data <- within(data, { require(nestcolor) ADSL <- rADSL }) -datanames(data) <- c("ADSL") -join_keys(data) <- default_cdisc_join_keys[datanames(data)] +join_keys(data) <- default_cdisc_join_keys[names(data)] app <- init( data = data, @@ -224,9 +216,6 @@ app <- init( selected = "COUNTRY", fixed = FALSE ) - ), - ggplot2_args = ggplot2_args( - labs = list(subtitle = "Plot generated by Bivariate Module") ) ) ) @@ -235,3 +224,18 @@ if (interactive()) { } } +\section{Examples in Shinylive}{ +\describe{ + \item{example-1}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXVIhrqu-lCkULpwAB6wqCJKAUEGxlzUAPoxUDbRgcFGugDutKQAFirsKbi6IEq6uoxwAI6CtNXsPqKkxNREjIoQlQDCAPIATHH+GRgmzPDs-QNdAL5dSmiowyp57BUjsQC8m1C4G3xCIqK6O6QwiRKJ9NostIFw692VuqGnu4lhpMwaiaKocAITxeLxS0Hg7wUYGmUP2zxBojgIg070RyNIfwBQI2IMq1Cg9CRkLAAGUkYDSLotHcCSJELCcbiCPkiLQCGJ3tTGPd6CJEszWezRMUMsBgFCYWAALpSuRw3EvNEUuD8YnECwM+G4ky0UIq94AMQAggAZEmuLWVLoguWM1jvFKfULfdQY-6A4G4sGwPQ7CWDTUKpUonbBt1Yz0K-GEvx+0nklFcnl0wMK3QCtkcnZJ2lwfkszPClJi-0DKEy22WxUJ8iquOCVBBADWcFTCpgwk0kV9umNZuc8rTOr1dd7pvNjKtjMrIMYRGyiRM6jglJ2jq+P3DHsnu3BPdLber6NRNcx26reIJRLjZOPOd5cHpeB3lQzQs5NIf+cFYhFQRL0IBtKsqDkGNb6nGdisACh4gsOEFjv2O7Wi8M4vG0i7LquHwbq6Z7YlW3oQnGkqgUeFInui+GRri0bXroUK3hR94ps+F7pgW77Zp+fJvr+xbioBZbAWhYHoghUJ2NUgTwGQsEvPBo59hOVYoVOzxdF0tAmLo7AqOQm7aI8ci2OUzyiIUECsEa6DsEsAAk9SlA5iKMDonRKLMShgLMUpAA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } + \item{example-2}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXQGEAIgEkAZS9dfihSKF04AA9YVBElUPCDYy5qAH1EqBsEsIijXQB3WlIACxV2TNxdECVdXUY4AEdBWgb2CDFSYmoiRkUIOoBBHwCAGWT64bGlAF9+gCsiFTSAazhWUQrc23z+OBMoYVI0gn5aUQI0xeW1jeBoeE3MuQBdN2h0CZVi9lqQ3N0AF5-uFcH8+EIRKIgbpSDA0hI0vRtCxaGE4L8BnVdFEYZk0tFSMwNGlRKg4ARMdjsZkHnpgQowFNRoywVjqaI4CINDDOdzjmSKVTqdjqFB6FyYYyAlyKaRdFpUeKRIhWX8RboCCUlgQxDDFYw0fQRCdtbRdU9csBgIzmYyXi85GyNXU+XK4PwpUyAOKuPDqkUmWhRD0wgBig1GAVc7Ox-WpToDrDxuQJUSJ6gF5MpAbqtNg9N0tpGLP9sddsp5wLdJMFOfLovFkoZYBl-IVSuNcFVZZdmrNFv1nZNWp1Yi24WtxemYAdiYbFf5oZb0YAGmqF7oYEdaHFCxGo85nS6gyHPcCD9Hc7p43Hj3VGEQCmkDrr5cD8YTiVmhdf8-AvTtXsRRrd9dFA0ls2FDUxQlagvTbOUO0NZVuw3PtR3NPVgQNI0RwHcdMinJkS3tR17xAytyHPIsmSwABZdCT2DZddEvGMNVvOp52pboX3UOAwM-dNv0g38G3-Qtp1LCjFyQ6sqLE+s+1g5taMQnlcNQntZOxTDBxw4c4FNMdLUnG0SJnOddLkjRWMZLwAHlHAAOQcABNJiNVPVj2OvLibz+fp+loExdHYFRyG-bQMTkWwaixUQyggVhBnQdg0FQAASFoqkyrLOUYHQ+lmJQwBmF4gA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } +} +} + diff --git a/man/tm_g_distribution.Rd b/man/tm_g_distribution.Rd index 033161a0c..0b7cae9be 100644 --- a/man/tm_g_distribution.Rd +++ b/man/tm_g_distribution.Rd @@ -74,14 +74,12 @@ It offers several tools, such as histograms, Q-Q plots, and various statistical visually and statistically analyze the variable's distribution. } \examples{ -library(teal.widgets) - +\dontshow{if (require("ggpmisc", quietly = TRUE) && require("ggpp", quietly = TRUE) && require("goftest", quietly = TRUE) && require("MASS", quietly = TRUE) && require("broom", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # general data example data <- teal_data() data <- within(data, { iris <- iris }) -datanames(data) <- "iris" app <- init( data = data, @@ -90,9 +88,6 @@ app <- init( dist_var = data_extract_spec( dataname = "iris", select = select_spec(variable_choices("iris"), "Petal.Length") - ), - ggplot2_args = ggplot2_args( - labs = list(subtitle = "Plot generated by Distribution Module") ) ) ) @@ -100,14 +95,14 @@ app <- init( if (interactive()) { shinyApp(app$ui, app$server) } - +\dontshow{\}) # examplesIf} +\dontshow{if (require("ggpmisc", quietly = TRUE) && require("ggpp", quietly = TRUE) && require("goftest", quietly = TRUE) && require("MASS", quietly = TRUE) && require("broom", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # CDISC data example data <- teal_data() data <- within(data, { ADSL <- rADSL }) -datanames(data) <- c("ADSL") -join_keys(data) <- default_cdisc_join_keys[datanames(data)] +join_keys(data) <- default_cdisc_join_keys[names(data)] vars1 <- choices_selected( variable_choices(data[["ADSL"]], c("ARM", "COUNTRY", "SEX")), @@ -140,9 +135,6 @@ app <- init( vars = vars1, multiple = TRUE ) - ), - ggplot2_args = ggplot2_args( - labs = list(subtitle = "Plot generated by Distribution Module") ) ) ) @@ -150,5 +142,20 @@ app <- init( if (interactive()) { shinyApp(app$ui, app$server) } - +\dontshow{\}) # examplesIf} +} +\section{Examples in Shinylive}{ +\describe{ + \item{example-1}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsBISqDC0ogT+uLpetHCk1Ky6ALz2Ts62AGTpuu7Rvv6B6BFR3rHxSSkuGVk53nkBRCbkoqRF0aUJyQ6VupnZnrVwfmAAsgCCAMrjrSVxHRVpPdX9PoP+TEREMNMxs+VdaUoAxLpSEGrUuvxQpFC6cAAesKgiSlc3BsZc1AD6b1A2r2utyMugA7rRSAALFTsP6REBKXS6HyhD7IxihJQAX0UECUaFQaJUEL8ECRf3KcMRuj4QhEonKdGapKRSNIMG+El+oVIGPogk01mprMuPO+WhYlKB3wevPUpG+olQcAILJFrL+0Hg5X8KNEEWF6tEcBEGnKxtNCqVKvYEoxUHoIm+BEhRFoBDEQz1-jkkX8AAVYtwMAAZCgSKE+w1I3Ei2O6XG42gmXTsFTkZiWHQ2WwIsm6UTQiCsUbodgEgAk3kileNjB0jFxWKUYCxAF0gA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } + \item{example-2}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsBISqDC0ogT+uLpetHCk1Ky6ALz2Ts62AGTpuu7Rvv6B6BFR3rHxSSkuGVk53nkBRCbkoqRF0aUJyQ6VupnZnrVwfmAAsgCCAMrjrSVxHRVpPdX9PoP+TEREMNMxs+VdaUoAxLoAwgAiAJLjJ7r8UKRQunAAHrCoIkp3DwbGXNQA+l8oDZPvdHkZdAB3WikAAWKnYQMiICUul0ozO4wAMj9shjsUoAL6KCAAKyIKn+AGs4KxRIiwbYIfw4CYoMJSP8CPxQgR-uTKTS6cBoPB6UC5ABdJRKLQsUQARlxBFhFIIYn+ojgIg0cH4fggaLljFoUHoIi5qto6vFYOAwH8+Kx-klksiBCGoywwyK-hOAHlHAA5BwATV9YHGzgAGv45HJcKjdFqdeR+OUg44sc6ICSlGhULiVDCDWigeUkUm+EIRKJytXhGJS2jdKQYP8JIDQqQTfRBJprEmW7du-9jRWwf8Xj31JzRKg4B6h8PbmDRXpko7Mc68MvhynF6RygeNJqF0vDSvhyq1WJysbTea4Jbb7aHvatwSwK73Z6AOKuHguj+AAQsMWAANJYAqcYJnuK4nmm5SgeBUEwbul5XmiMAcrQ7wbroABioxYlGiaYVhJi0M8erlMRpGuBRw4klecFMcmM4PGOLATlx07MKe86Ls2V5AuuyFgE6ETwWiVHUOQjDlHJClnsJMktsadbJJpCrkVhLY4fJeEiHsqTqSxK5sVeEiMEQgioNxinJECU7PDOgnniJK5ibABGfjuemUbQ8kyEpwUqUJF76Ua8r3vKunqdhuH4aZLjmfBFlohZJIkrQJi6OwKgKbO2iDPGugopeojwhArCjOg7AFgAJN4kTNVqjA6IwJKEkoYCEpKQA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } } +} + diff --git a/man/tm_g_response.Rd b/man/tm_g_response.Rd index 6e9e1e93c..4c34a0f6f 100644 --- a/man/tm_g_response.Rd +++ b/man/tm_g_response.Rd @@ -98,8 +98,6 @@ For more examples, please see the vignette "Using response plot" via } \examples{ # general data example -library(teal.widgets) - data <- teal_data() data <- within(data, { require(nestcolor) @@ -108,7 +106,6 @@ data <- within(data, { mtcars[[v]] <- as.factor(mtcars[[v]]) } }) -datanames(data) <- "mtcars" app <- init( data = data, @@ -134,9 +131,6 @@ app <- init( multiple = FALSE, fixed = FALSE ) - ), - ggplot2_args = ggplot2_args( - labs = list(subtitle = "Plot generated by Response Module") ) ) ) @@ -146,15 +140,12 @@ if (interactive()) { } # CDISC data example -library(teal.widgets) - data <- teal_data() data <- within(data, { require(nestcolor) ADSL <- rADSL }) -datanames(data) <- c("ADSL") -join_keys(data) <- default_cdisc_join_keys[datanames(data)] +join_keys(data) <- default_cdisc_join_keys[names(data)] app <- init( data = data, @@ -180,9 +171,6 @@ app <- init( multiple = FALSE, fixed = FALSE ) - ), - ggplot2_args = ggplot2_args( - labs = list(subtitle = "Plot generated by Response Module") ) ) ) @@ -192,3 +180,18 @@ if (interactive()) { } } +\section{Examples in Shinylive}{ +\describe{ + \item{example-1}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXVIhrqu-lCkULpwAB6wqCJKAUEGxlzUAPoxUDbRgcFGugDutKQAFirsKbi6IEq6uoxwAI6CtNXsPqKkxNREjIoQlTCtLKJxur0E-RWmHbrsWroqugTsCoSs1Iuli1qiq7qLsFuLUiyLcrbl3ZVDfYyiwMBaALp3g1DiJuqkHezD-Tf3d12VAF8lACuko0KhBio8gszildABefwZXBjPhCEQDRFo4RiGHnXSkGCJCSJaqiVAkURwPH43TUKD0OB+RGLLBiCkQKm6AAK7VImzwY3xZI5XMRKUSYVIzA0iXJcHmQtpKWg8AR2zAXyuqyV+KpIg06v1CtIctQCpptPO9MZzI1AGUmSbdFoWLQGSJEDqzlbKgR8kRaAQxOrXYx3fQRIl-YHg6JihkbostQKHqVFUsVngNQdGEc5Cifb7jRo4Px1YsCMtvb7zjBhJpInpEQAxACCABl7c5C7XKiZaKEy+r213XEX8f9aQXdbpQuqJVKZab5YqJ+cVbBmxqUzXi07DYiSyvzWu+3SGUyK2BHQbSC63R64F7Bev8TGgyHEWGI1GP3GEyCJNNUuVM7nTBYwA2PYUBgfNez7Y9hxZKCBQQ2t62oRsRBHTtu3Q30ByHctWzw8daynSclSnLouloExJhUchl20aljjKMZREKCBWDbdB2HBAASepSiEqlGB0TpgSUMAATuIA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } + \item{example-2}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXQGEAIgEkAZS9dfihSKF04AA9YVBElUPCDYy5qAH1EqBsEsIijXQB3WlIACxV2TNxdECVdXUY4AEdBWgb2CDFSYmoiRkUIOoBBHwCAGWT64bGlAF9+gCsiFTSAazhWUQrc23z+OBMoYVI0gn5aUQI0xeW1jeBoeE3MuQBdN2h0CZVi9lqQ3N0AF5-uFcH8+EIRKIgboIcIxL8BnVdKQYGkJGkGqJUCRRHBEcjkdQoPQ4NQYQowFgxDiIHjdAAFHqkUSUsFIwlY2n04GZNLRUjMDRpbFwAgEwnIzIPPTAylTUZsv6S3R4kQaGFqsXHUXi5Uq3TE0nkuVgAJk7W6LQsWgkkSIJUcg0EEpLAhiGHWxi2+giE6u2jup65YDAeUjRVgF4vKp6sAAIQAslgANJYABMbN0lK8AHlHAA5BwATUpcjk7INyK1Gjg-ApCeTaczeH1KpgR1ocVlugAYoNRgFnJWq6ZaFE6zD+4PXE7Cf0VRW27oojC+QKhTrUGKJSrpbAe+Hpq259WLRrgTWtzvl4SjWSG+b1aQrTa7XAHSfR7oXW6PcCvR9P1f0DBFMlDI9I2jWNfjNZwAA0s0pLBBi8VwwHLEcqyvSdTRQtDHW-DtqE0bspwHIcsINExx1wvsKNnKsF0lZi6mY-p+loExdHYFRyE3bR8XLao-lEMoIFYQZ0HYNBUAAEhaKpZLkvFGB0PpZiUMAZheIA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } +} +} + diff --git a/man/tm_g_scatterplot.Rd b/man/tm_g_scatterplot.Rd index 466294031..5c1c306f7 100644 --- a/man/tm_g_scatterplot.Rd +++ b/man/tm_g_scatterplot.Rd @@ -108,15 +108,13 @@ For more examples, please see the vignette "Using scatterplot" via \code{vignette("using-scatterplot", package = "teal.modules.general")}. } \examples{ -library(teal.widgets) - +\dontshow{if (require("ggpmisc", quietly = TRUE) && require("ggExtra", quietly = TRUE) && require("colourpicker", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # general data example data <- teal_data() data <- within(data, { require(nestcolor) CO2 <- CO2 }) -datanames(data) <- "CO2" app <- init( data = data, @@ -185,9 +183,6 @@ app <- init( multiple = FALSE, fixed = FALSE ) - ), - ggplot2_args = ggplot2_args( - labs = list(subtitle = "Plot generated by Scatterplot Module") ) ) ) @@ -195,15 +190,15 @@ app <- init( if (interactive()) { shinyApp(app$ui, app$server) } - +\dontshow{\}) # examplesIf} +\dontshow{if (require("ggpmisc", quietly = TRUE) && require("ggExtra", quietly = TRUE) && require("colourpicker", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # CDISC data example data <- teal_data() data <- within(data, { require(nestcolor) ADSL <- rADSL }) -datanames(data) <- c("ADSL") -join_keys(data) <- default_cdisc_join_keys[datanames(data)] +join_keys(data) <- default_cdisc_join_keys[names(data)] app <- init( data = data, @@ -272,9 +267,6 @@ app <- init( multiple = FALSE, fixed = FALSE ) - ), - ggplot2_args = ggplot2_args( - labs = list(subtitle = "Plot generated by Scatterplot Module") ) ) ) @@ -282,5 +274,20 @@ app <- init( if (interactive()) { shinyApp(app$ui, app$server) } - +\dontshow{\}) # examplesIf} +} +\section{Examples in Shinylive}{ +\describe{ + \item{example-1}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsBISqDC0ogT+uLpetHCk1Ky6ALz2Ts62AGTpuu7Rvv6BzgAepMwRUd6x8UkpLhlZOd55hETURIKMqLQEANYyZdGVCckOtUoAxLpSEGrUuvxQpFC6cIWwqCJK84sGxlzUAPpbUDabC0tGugDutKQAFirsR5EgSrrZno1w7NOipMStjEUEDeAGEAPIAJh2unBEKUAF8gUo0KhoSobn5gXMztUnq9dHwhCJRNVCcIxJi3m9SDB9hJ9mEFuQOq1SJSqW9qFB6HBZsl-ABlAhMmTrIikGG3IhdMQRfEcwq4s77FYldSkBmoOAEdkct5HaDwar+WFyrF63SiXnaiXJK0iDSa7W6i26Lk8vm6QXWjS6LQsWjckSIM2uqkEKUyknJf2MQP0ET7CPSggUo7AYAmyH+AC6OciOv8xAsZX8glQi16-jkclw8td9ptcH4xuaJbw9YtMGEmnWemSADEAIIAGQFzjr5tdJlohWb1WHY9cU45QIttc7uiG2MWKuKzEdoi1hZXVINsH7XrApo7p7ejd9dp9GqPzs3HPdvNbAuffoDQbgENbzDN5kyjapY3jRMwNTURHjODMszhMA8wLPw23CPAr3LSs4GrDc7ypB9yBbfkwBwqAq2AkDu2oXsRAXUdx0nEDTFnedByY5cwzXPUCItf4iEYfZ6G3I49zVQ9jxdDlzyNMibxYhtfyfB0X2k98qU-T1vTUv84wAoClLDGCxAg-8EzgJNI1gmTXXTTNr2zFD800jlCzAAAFLkyFLMA7FYLU-LsdwFngXysKLEhMMiMsK0ovCwF4njjOUtSON0AA5RwRxHVKux7Wg+0Ypd8r1Gc51I3RF3HTTkqpfi9VEWgAC8rNEpVd1VA91LfQi5MvJDQzSm1qmIp0T1Y7Tv1-SDDOGkybLMmMLOgpa4IcoaXLQqL21i8j4qomsyo5YiMri3CFtdWj6MvGqJzctjKpK2rCPqt5Go5RgiEufYTHUWJOqgCSeomuz9TOQ1Bqc5CTstFT4bUsHHumsifz0ubLKMx7TOjfSoKs3H4MWRCYdzfNdA87yoAi-aAqCyL-NCmkKFIfC4fvZ8Muy3KOYJQris40rHoqjL7rqzdPvDFo-oB20d2B7r1WR-rIYvVtFM04ixufFWpu5L80dm1bAKugT1vMgzLOslM0wQxyb1Qyn0Op2mr3pxK6eZ8K2aSqWLTOqqebyx6bqKhiheYkX2Kq8W3sl+teKBIFaBMXR2BUZl1W0L4a10F4sVEe4IFYId0HYFEABJvEiKurUYHRAQRJQwHhHMgA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } + \item{example-2}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsBISqDC0ogT+uLpetHCk1Ky6ALz2Ts62AGTpuu7Rvv6BzgAepMwRUd6x8UkpLhlZOd55hETURIKMqLQEANYyZdGVCckOtUoAxLoAwgAiAJIAypO6-FCkULpwhbCoIkorawbGXNQA+vtQNnur60a6AO60pAAWKuznkSBKutmejXDsEDEpGIrUYigg3wAgtN5gAZQ7ZaFwpQAX3BACsiCoTr1WKI3tdbLd+HATFBhKQTgR+KECCdMdjcaJgNB4PjznIALpKJRoVAIlSPPwQ5bXarvL66PhCESiarS4RiYXfb6kGAnCQnMKrcgdVqkZUq77UKD0ODUar+eYEHUyHZEUhTJ5YghiCKSo2FcXXE6bErqSmiVBwAiGo3fc6svTJfxI2HukXh3Sic0hx3JFMiDRa4Ohj1J3Qms0WmNgeapjS6LQsWimkSIBMFlUEZ1dMTVauMWv0ERU1uu9nXYDAWMw+NgTmcyJ5sCQgDirjwun8ACEALJYADSWAAjGVVxvtwAmfxyOS4fNJzNpuD8S2zheNptSim0HbR3QAMUhsPmzgviYFiYtCFLe1Tfr+riAUa4JJuel66EMoprL6xTMNmQYhmG4aRrAH6jsieAId816VhmFaBrm2FJkW5r3uWWaOp23b1k+TYti67bJMxdZwH2nGDmsw4EeOk7Tn4D6LpEB5bru+5gOusknmAZ4Ac+yYUWBpaKdue5EdB4YwK+77gT+f5qc+wGgXeyQQX+xG6LB4bwQZIJEIwJz0Eh5yof6GFUQ5uHwPecZseGpHphpjE5lhDnGqadGlgxaZVjWvENvp6kcW2crcWlPZ8dlA7UQW5zCbOY7+GJcXNhJ85ScuCmHnJS4yce8lYJCkwNf4WDOHOswAPIAHJ6U5TYuepEVabow2OLCsIWU2RnUJoJm2WZ-41VZM12VBE0IZN4W0AAXnxXneihfroZRsUGRG1xRiFlWZQWEXVBFMV5vdKq0SWjXJZWPEFRlS0FkVXGpV2vH8TlBJCSOFWEWJugzvV8k6S1qk1dNNmNejr3LcZIimZBYNJjteN7Q540qkdRqMEQdwnGSrqRT510Bl9JUPWsT2lqFhPhRRH0UdzNV-fRIvA6xQtJhDuVQyxhX9kqZWI4LKMzpjynSWAnXdR1-VDaNp7029ml43NC3k4ZxMfntttGpTpP2T9tPfOb3wgiz6ixJdUC+Td4s-UF+FI+OTtRSl5HRZh33qZLSXS-lstR97quKzLKsCfDUDlZrU6oxJOsdV1PX68bI1jV7wuMTN1uLTVK1rSTG1k9tIG7ZtNOHfmTnguCtAmLo7AqLqAbaP8Z66J8IqiC8ECsJC6DsHyAAk3iRBvKaMDoYKokoYAopyQA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } } +} + diff --git a/man/tm_g_scatterplotmatrix.Rd b/man/tm_g_scatterplotmatrix.Rd index 65672cb11..ec2645a59 100644 --- a/man/tm_g_scatterplotmatrix.Rd +++ b/man/tm_g_scatterplotmatrix.Rd @@ -48,6 +48,7 @@ For more examples, please see the vignette "Using scatterplot matrix" via \code{vignette("using-scatterplot-matrix", package = "teal.modules.general")}. } \examples{ +\dontshow{if (require("lattice", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # general data example data <- teal_data() data <- within(data, { @@ -81,7 +82,6 @@ data <- within(data, { profit = rnorm(50, 20, 10) ) }) -datanames(data) <- c("countries", "sales") join_keys(data) <- join_keys( join_key("countries", "countries", "id"), join_key("sales", "sales", "id"), @@ -130,15 +130,15 @@ app <- init( if (interactive()) { shinyApp(app$ui, app$server) } - +\dontshow{\}) # examplesIf} +\dontshow{if (require("lattice", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # CDISC data example data <- teal_data() data <- within(data, { ADSL <- rADSL ADRS <- rADRS }) -datanames(data) <- c("ADSL", "ADRS") -join_keys(data) <- default_cdisc_join_keys[datanames(data)] +join_keys(data) <- default_cdisc_join_keys[names(data)] app <- init( data = data, @@ -182,5 +182,20 @@ app <- init( if (interactive()) { shinyApp(app$ui, app$server) } - +\dontshow{\}) # examplesIf} +} +\section{Examples in Shinylive}{ +\describe{ + \item{example-1}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CmlCkmgRw-ri6XrRwpNSsugC89k7OihAAxLpSEGrUuvyBULpwAB6wqCJK+aSFRrpc1AD6VVA2lQUGxgDutKQAFirszeEgSrq6xOakjFGiHXkFGCbM8H4QY2O0-AnjfmAAIq54uv4AYlhhx2AAknYX-s4AyndgAAq3R-4A4ucfYAByABlngAhQ7hfwAxzPACC7zkuFG6wkRB0jAg8DI2xM6lIREYq3W6wI7AATOEyboKQBGcm03Q0+nhBkk+GIwnUKD0ODUWaJYn+ACyJBYBF6rGeWDgqEE9DoBH8qUJrLW6w5EAkgigUga2JgtFiWJxeIJhJ2DIAzOFLbprdbqUyrUzlabdByuTztvywJ8ZDAoMp5b8ABLckQBiVEP0WUJgRXrZ3rVBEaUczQkT3sAAc1oAbAB2cI5gAM4QALAX6SX6QyqRWqQyixgc+EAJwJsYsOCFPnsc0AVgrfb7FqLDL7Rb7rep5oppZH5Kb4Wz7cy-FQGfNGFLC4rJIwNa34Ub1sbFMbFcbk90jYbW5X-Dg9FIGb3zIwdsPlMXX4-25-C7-PdfzjONRG4MQ5maRZljgE0Ni2RIqUQccERVMYJjINgGk2bYwJgcpYLZIldgOZ4zmeG5nkeZ43meb5nkBEEwUuSEYThVCXVEWgAC89ESFCiLGdxynUPikhcIiV1YLtGFwvFSHYPCCNJUci0QEkiw08IUN0YSORCbYHBcOQVx0CBBDEpSRHYL1RD9ahqGeeB+FoQQYGeDlGCkZ4SDobIFW0qs9NEwzkhXAh-RCBy4AQ3QrNg4kjOccITmhAEHhSQLwmCgzEiSlcvH9TRSDiRI0TxGB2B0qkiyrDTwqIURSF5XSIAqqqq0zOqixXVBGCIEwem2crGEqnStMrEClAAX1SAArIgVAaABrOBWFEQYClsWoFqW1b1pNXaIBWtbdgwqYZmec7pjEZ5NgCxEjpOjh-DAkRRGeN7bt+e7Yw43Qnv2s6iEmG6Pt+L7wfCL1fu2fxrtYbD+AVVJUiUNB11qFQehNZptiGRE+CEd7tiJ4QxDguoYAaCQGlECKghkcoiFIP0LuKSmxjdbk4bAB4GfIRhmefNnpmKMJBN0LQWFoTkScSOgms59ZmgaEophxOnUDgfk0JdeZqmgeBeeuy68ElwlRG5HXn0SK2RA0LWdeVl1udyRJ-Aea2NClmW5bERAJb1-Xxl6RaQha6Xpn9hpRXDinmmAYB4ZBzCzYAXXTlcQ-tm2YozfxOygZ4JDXZ4HyfB7g-1mBhE0AjQpcf6Q7GPEH3cWKkublvBuKfPElS9LXGrpULd0bOVYKNXig1x3RG13WW4N-1YDE17wKhsexkG6hBaxfVBadxel9dTkeY9vnvefKPZdlOBA-NkfTSjlqU9BxHfu7kO49oCPtml6gFlY5h1-gnAoSd17vX8JncEhBU5TA-sjP6W91i5w0P3HY-hSK-HIr8SivxqK-For8eivxGK-FBM8VivxYRVxProWuu9aANzyskFBE9LZX1wlfI+LtTRu15l7B218-Z31EA-L++sf5-0SDfGO0iwHVAgWASG0D07Q12IVMgPRxS-GIE1KGlw+oDR6CjSRnEr4YK9Fo4qujYH6Oas8Yxg1SB0JPow+uIhG7JRQa3Rg7cMFd18aYWgfdYqDwyuwsecZR56ymhAVItATC6HYCoQWOJtCwRMroEYKpRD9AgKwaE6B2AYwACTeHCOUq2jBUSpGmkoMA0105AA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } + \item{example-2}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CmlCkmgRw-ri6XrRwpNSsugC89k7OihAAxLoAwgAiAJIAypm6-IFQunAAHrCoIkolpGVGulzUAPr1UDZ1pQbGAO60pAAWKuwd4SBKuroAgtn5ADK9uoxzi1Oz2Vj5y6tb+UoAvqkAVkQqrQDWcKyiY6W2TfxwJlDCpK0E-LSiBK1nF2ut2A0Hgdw6cgAukolGhUMsVIM-BBph0EsVSrgNnwhCJROiccIxMjptNSDBWhJWr9AuRGDUiOTAoxaBUSaTptQoPQ4NR0f58gRaTIGaRdDBmaywhsOVoWLRuXj0XRRKR2RzUaVWpVSMwNNTUHACOqNZqGqC9Il-GsFtKUabSaJeUaxYknSJ9aJDcaZQ7OdzefywPlnRpdHKWYqxIg7X6OQQhucQvjEhGFfQRJ9E7Rk-cGsBgNb5rawJDIXIsfa47p3S64Px0T6wDMAOKuPC6fxYGaZdvhAXOAAa-grvr9MHetBqlqSLkr1emREYz3cDcSDjnY4dJlZ9fRADEZgt8q4qw7Un7R2eOR1tRVdeoPl6jSbTR0LUG5ttY3Gd9Q6eif50gaL5bqaXI8nyVrBqGYoUPwqDnGQogxngYEahGKa6E2AAKMzdgAsjkYSds2ABqBS5HYI7zguCZJmI6JytQghwFmDHgqUBZFt+paQuEuH4TMRHZCR1oUfkVE0dhfhgHhhFieRlHUWAchXguNawXu0G5AAcmRzh2LoxjOLp2S6AA8vuuh6dkjiZHYuQWbpP7VhO-5TiI6Ibqe1bqXGtZhm6sEgT614OhBgbQSGHpimmUYoa5cb0TmjGpvKUbsalnH5oWzb7P4Zb+dWgXkGuMnWm2ikzGRR7VdkACaNHoRy7maNO3nJLR1ZLiu2mzs43W-ru5WHsevlxhe55blN0xTakqS0CYujsCodKPtocA2LYkz2qIIwQKwMzoOwcIACTeOE51OowOiMKkhxKGAhyQkAA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } } +} + diff --git a/man/tm_missing_data.Rd b/man/tm_missing_data.Rd index 878adeb14..a758b5a85 100644 --- a/man/tm_missing_data.Rd +++ b/man/tm_missing_data.Rd @@ -58,18 +58,7 @@ It is useful for clinical data analysis within the context of \code{CDISC} stand adaptable for general data analysis purposes. } \examples{ -library(teal.widgets) - -# module specification used in apps below -tm_missing_data_module <- tm_missing_data( - ggplot2_args = list( - "Combinations Hist" = ggplot2_args( - labs = list(subtitle = "Plot produced by Missing Data Module", caption = NULL) - ), - "Combinations Main" = ggplot2_args(labs = list(title = NULL)) - ) -) - +\dontshow{if (require("gridExtra", quietly = TRUE) && require("rlang", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # general example data data <- teal_data() data <- within(data, { @@ -88,16 +77,18 @@ data <- within(data, { mtcars[["cyl"]] <- as.factor(mtcars[["cyl"]]) mtcars[["gear"]] <- as.factor(mtcars[["gear"]]) }) -datanames(data) <- c("iris", "mtcars") app <- init( data = data, - modules = modules(tm_missing_data_module) + modules = modules( + tm_missing_data() + ) ) if (interactive()) { shinyApp(app$ui, app$server) } - +\dontshow{\}) # examplesIf} +\dontshow{if (require("gridExtra", quietly = TRUE) && require("rlang", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # CDISC example data data <- teal_data() data <- within(data, { @@ -105,15 +96,31 @@ data <- within(data, { ADSL <- rADSL ADRS <- rADRS }) -datanames(data) <- c("ADSL", "ADRS") -join_keys(data) <- default_cdisc_join_keys[datanames(data)] +join_keys(data) <- default_cdisc_join_keys[names(data)] app <- init( data = data, - modules = modules(tm_missing_data_module) + modules = modules( + tm_missing_data() + ) ) if (interactive()) { shinyApp(app$ui, app$server) } - +\dontshow{\}) # examplesIf} +} +\section{Examples in Shinylive}{ +\describe{ + \item{example-1}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsBKMtPzOAB6kzP64ul60cKTUrLoAvPZOzrYAZJm67rG+-ozUUBASUTHe8YkpaS6KEADEulIQatS6cKGwqCK6-FCkUEr9gwbGXNQA+iNQNsMDUGO6AO60pAAWKuwz0SBKurme3r6toqTE1ESM9fu6UPz8k9CiS2YWmtahtnsQBwehwFE3RE7FEnkm3BIEnYX2iJkuV3YIlKGxhtgAVLlzLQTOwAIzRDAABgArIS8QB2OTUgC6SwAcgBBW7-W4AXyUtx8tBeRl03NEtxg5xYvOMwoIos5v35QVEwDpfOK6ES7AF0Xuj2e9QOEtFCqWyp6HD1jFEGoeTygoh1ulN8uA-gIrGo-hpiuM1owJnUpER9uAjsILrdNNtAaDUhYoaWXp9Gn9IrNgf8UcYofqbJu0HQSxUaz8MpmNR2QoEwjENT4QhEokLf10pBgkxgPNEKgk0wWcxl9XqON0atUzEsOhs31uok2EFYjPQ7DQqAAJN4Negl2DGDprkoORAwGyaUA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } + \item{example-2}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsBKMtPzOAB6kzP64ul60cKTUrLoAvPZOzrYAZJm67rG+-ozUUBASUTHe8YkpaS6KEADEugDCACIAkgDKzbpwobCoIrr8UKRQSiNjBsZc1AD6k1A2E6NQ07oA7rSkABYq7IvRIEq6uZ7evhBipMTURIz1pwCCrZ0AMuuML+8nui9YnU+-06SgAvvUAFZEFRzADWcFYogOq1sRmGcBMUGEpDmBH4tFEBDmUJh8MRwGg8CRizkAF0lEo0Kh1iptn4IKdFjVDr8+EIRKIanzhGJ2adTqQYHMYATRCoJAtVssObp6vVaCZdOwVORmJYdDZbMcVaI9hBWE90OwmQASbzRW2iGQ6B5gpRgUG0oA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } +} } + diff --git a/man/tm_outliers.Rd b/man/tm_outliers.Rd index 4ca23deeb..ff738de8d 100644 --- a/man/tm_outliers.Rd +++ b/man/tm_outliers.Rd @@ -58,15 +58,12 @@ such as IQR, Z-score, and Percentiles, and offers visualizations including box plots, density plots, and cumulative distribution plots to help interpret the outliers. } \examples{ -library(teal.widgets) - # general data example data <- teal_data() data <- within(data, { CO2 <- CO2 CO2[["primary_key"]] <- seq_len(nrow(CO2)) }) -datanames(data) <- "CO2" join_keys(data) <- join_keys(join_key("CO2", "CO2", "primary_key")) vars <- choices_selected(variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment"))) @@ -97,11 +94,6 @@ app <- init( multiple = TRUE ) ) - ), - ggplot2_args = list( - ggplot2_args( - labs = list(subtitle = "Plot generated by Outliers Module") - ) ) ) ) @@ -115,8 +107,7 @@ data <- teal_data() data <- within(data, { ADSL <- rADSL }) -datanames(data) <- "ADSL" -join_keys(data) <- default_cdisc_join_keys[datanames(data)] +join_keys(data) <- default_cdisc_join_keys[names(data)] fact_vars_adsl <- names(Filter(isTRUE, sapply(data[["ADSL"]], is.factor))) vars <- choices_selected(variable_choices(data[["ADSL"]], fact_vars_adsl)) @@ -147,11 +138,6 @@ app <- init( multiple = TRUE ) ) - ), - ggplot2_args = list( - ggplot2_args( - labs = list(subtitle = "Plot generated by Outliers Module") - ) ) ) ) @@ -161,3 +147,18 @@ if (interactive()) { } } +\section{Examples in Shinylive}{ +\describe{ + \item{example-1}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXVIhrqu-lCkULpwAB6wqCJKAUEGxlzUAPoxUDbRgcFGugDutKQAFirsKbi6IEq6ugDCAPIATHHV9RVNdcDACmCojLQwLKyJANZwrJ0AumONonAAjokiEOwQjETZ7LV1cooQAL7bAFZEKkMjosUZtlmHx8OsZ9cQJxydG52lL814up3dvf1PnS2bggWhYokaBHyRwIYkS0xEGjg-HYoJ6UHoIkSkOhYnOQXaHzq4zGpQI7E6AAVqFAyG9vmA7KxUHA6Z07Iw4IF4LSwFttko0KhGio8uSIJUUroALz+DK4Fp8IQicEyxXCXEtSqkGCJIiCUh0GRnTWVXR6g20GSJVHS3R0USkMWm52yoKJMKkZgaOHMskml2ummwPQywlvf0u+FwDS2qPe0S+p0Bl3U+hwPyhsAAZXT0dIulRtHRIkQ4fFyed2NoMJVBZYRYxcCxUOruJSBLArzAE1J5MIJAIrLAglQQWGgLk8vLFcqcfI-FtnRHY5ZeAjAZgwk0kRDugAYgBBAAyWecU5nppMtFCSNth5Prmnye2FZfLsnEYIgTgEiIPS-SQ2jK9qOuugbuqEnrqKQPrRkmFYpNA8CLp2nznjOV7UOQjC2ph2GwX6T4VqitYkehF5VjWtqgtQghNpRbYZB2XY9nWjCiAAJHOSIfkRybcQuMo0XRzY4mc7YdKhRLdiSbGcQJvEXpUm5YbQO62g4LhgZUb4Brppr6W+2zbLQJi6OwKjYdB2hwDYtjlOWoiFBArAHug7CChxgi0KUnnTIwOiMNsOxKGAOxjEAA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } + \item{example-2}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXQGEAIgEkAZS9dfihSKF04AA9YVBElUPCDYy5qAH1EqBsEsIijXQB3WlIACxV2TNxdECVdXQBBHwCAGWTdRkaWpQBfRQgAKyIVNIBrOFZRCtzbfP44EyhhUjSCflpRAjTB4bGJ4Gh4Scy5AF03CAWNNK0WUTSoflFqNoOxdgAxWmpyRnZ1hxcVVEaDiHEywGACjAnWaUJOJyq6wwl1IREYcgxShujFEbQIJSGBDEaVEcBEGjg-HY2NoUHoIhWBNoRKOuQhUJhcIRpnUy2xdweT0xECUILaKmK7FqIVyugAvDLwrhpXwhCJcQrVcI3tK6qQYGkiIJSHQZJNdXVdEaTbQZNcWPLdHRRKQpRBLR7FVA0tFSMwrqJUHACG7PZ7Mq9HRymrC8Baw6TyaRHYng8tA8HQ2HPdQ6WSo2AAmS07oaXSRIgocr3dmPfjCWJHWX6XBGQ3WeF2dCY1yqiGOQBxVx4XRQgBCAFksABpLAARihGOrtY9qYp-AL9SHVfj2ZgS1ocT0Cve9WaAWcy5XdRMtCilMdp-Prhrtb6b93civdbCcAkaOZbh7UYR1nVdXc6kyH0oj9XkSSDftX2zCNYGPUduy6OMkLDW9vhkR1cJ+eDMwgz1+SbW5vxXetmUbBUbmoQRWxolkpk7SEMNjeEqn5AASNdyH4L9SNXYt1woxjmKZVjwQ4zkwG40tbn4sTBOE7C9wPI9HQBF9r3fbMDI9IzdAMvo+loExdD+VR-U0HQbFsGoa1EMoIFYep0HYEFeMEWgqh80lGB0dEeiUMBuhOIA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } +} +} + diff --git a/man/tm_t_crosstable.Rd b/man/tm_t_crosstable.Rd index 54b96b06e..a9a1354cd 100644 --- a/man/tm_t_crosstable.Rd +++ b/man/tm_t_crosstable.Rd @@ -62,9 +62,8 @@ For more examples, please see the vignette "Using cross table" via \code{vignette("using-cross-table", package = "teal.modules.general")}. } \examples{ +\dontshow{if (require("rtables", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # general data example -library(teal.widgets) - data <- teal_data() data <- within(data, { mtcars <- mtcars @@ -73,7 +72,6 @@ data <- within(data, { } mtcars[["primary_key"]] <- seq_len(nrow(mtcars)) }) -datanames(data) <- "mtcars" join_keys(data) <- join_keys(join_key("mtcars", "mtcars", "primary_key")) app <- init( @@ -101,9 +99,6 @@ app <- init( multiple = FALSE, fixed = FALSE ) - ), - basic_table_args = basic_table_args( - subtitles = "Table generated by Crosstable Module" ) ) ) @@ -111,16 +106,14 @@ app <- init( if (interactive()) { shinyApp(app$ui, app$server) } - +\dontshow{\}) # examplesIf} +\dontshow{if (require("rtables", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # CDISC data example -library(teal.widgets) - data <- teal_data() data <- within(data, { ADSL <- rADSL }) -datanames(data) <- "ADSL" -join_keys(data) <- default_cdisc_join_keys[datanames(data)] +join_keys(data) <- default_cdisc_join_keys[names(data)] app <- init( data = data, @@ -153,9 +146,6 @@ app <- init( multiple = FALSE, fixed = FALSE ) - ), - basic_table_args = basic_table_args( - subtitles = "Table generated by Crosstable Module" ) ) ) @@ -163,5 +153,20 @@ app <- init( if (interactive()) { shinyApp(app$ui, app$server) } - +\dontshow{\}) # examplesIf} } +\section{Examples in Shinylive}{ +\describe{ + \item{example-1}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsIykUPQiov64ul60cKTUrLoAvPZOzooQAMS6UhBq1Lr8UEG6cAAesKgiSgVFRrpc1AD61VA2VYVQBsYA7rSkABYq7M0RIEq6ujCkBCyinRNTM2OmRIy67Fq6KroEfoSs1OG6-lpheEcoMIf+Uiz+crajEOPjk9OMosDAWgC633NQ4hM6lIK3Yrxmnx+3zS4wAvktwe9Pv5UIxaDAWKwGgBrOCsfy-OaiTwNEQQdgQRhELpghbve5KWFpABWRBUOLxoiG7VstVZ7NxrC5-IgHI4-kRpwiErpUvOqPRmLFdzSSjQqDmKl6fie+XaiT1QVwCIEwjEBr4QlCOuedRgDVIDQIVNEoiCITgNttumowTgeSS-gAwi7ZnZgpU8EtbSUDc0GqVSMwNA1RKg4Dto97mtB4AaZW8pVnbcSRBoDaWM460xmvd7nr76P782AAMr+qu6LQsWgRuCIcLF70EPpsgjmpLdtF9p2j2jjrnNZFgSUE74RTN7A5nY5y-ywK5gG6MFXG3X18aVjRwfgGzcEfaH493M8X54wYSaCp6JIOFyvt9dBWfgZBvA0-2cAC3xMWgSjApIADEAEEABlW1cc9vRhLCoOeeIknjRNk2rdNM0w20c1gH9zlXKNyOeK9SArDsUxrMjAJ9P0A3OdsyyYqdew9Ac6I4kcxwnLsexnMT5zEbkgmXWjfg3XYH23aUwBOQ8Dx3I84FuMB7lw+tGPg84tJEwCP2oL8RANZC0MgodbRguDb0Q1D0Oc3RsNtXyfKWNI0loEw1hUchiO0T17l0R5LwGCBWCQ9B2HVAASbwInS4lGB0Rg0nhCAwFhb4gA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } + \item{example-2}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsIykUPQiov64ul60cKTUrLoAvPZOzooQAMS6AMIAIgCSAMpZuvxQQbpwAB6wqCJKpeVGulzUAPoNUDb1ZVAGxgDutKQAFirsHREgSrq6AII5BQAyfbqM80tKAL5pAFZEKq0A1nCsouM9tk38cCZQwqStBPy0ogStewfHp8DQ8GcdcgAukolGhUCsVEM-BAZh1EiUerhpro+EJQvDUcIxNCZjNSDBWg8CIwiKJREEQnAcbiZtRgnBqPD-FkSWT7ME6nhkTTKvCOq0qqRmBpWqJUHACNSabCer89El-OtFuFudLRAyJaR4eqRCKxRKpdLafTGQqwAUNRpdFoWLQOXBECqYUbcQRhvsCGJ4TbGHbKY93bRPf8esBgIqFsqwIDARFRIJ6OqtUkzBZNNYAbops6XbjaPxeU0AIQ29Bxc5BCIqYYyIaiCLUIgSIPcdgARjkEUl-hyZTg4V0-gACgB5Ap5AAaGgHw7Hk+opH8cjSuZp7lIgkYEHYcpDQTkwHzlUBK9X2yROZdOs1cH4TLAWRHjgAcg4AJpO1co+60Wry5IuBeX5EIw1zuHeSQOIBqpGiYtCVLe8IAGKzIsBSuJeNKnlhQHSvEST8oKwoPPq3aYbiHRyveSqflelrJro156uKZFfnS9AMveFq6lqPp+iIjpcuRNJuh6XpJHx9oBmJe5QGGEYbNGsaMQmSbwqmlgZhcWYwS6R4rKWtQcBMugvBgtwaCBDZNi21DtsuulGuum7bruFZQAeR4no5uLnj5MxMeQEGDuazgTrRuYwD+f7Iah6G4bmcEIcFKFoRhubYbimWnmkaS0CYujsCo5DEdoVLLjpzqiKMECsLM6DsGCAAk3gRM16qMDojBpJsShgJsgJAA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } +} +} + diff --git a/man/tm_variable_browser.Rd b/man/tm_variable_browser.Rd index 00d3548b7..b36911ed4 100644 --- a/man/tm_variable_browser.Rd +++ b/man/tm_variable_browser.Rd @@ -54,16 +54,7 @@ or continuous with a checkbox allowing users to switch how they are treated(if < then the default is discrete, otherwise it is continuous). } \examples{ -library(teal.widgets) - -# Module specification used in apps below -tm_variable_browser_module <- tm_variable_browser( - label = "Variable browser", - ggplot2_args = ggplot2_args( - labs = list(subtitle = "Plot generated by Variable Browser Module") - ) -) - +\dontshow{if (require("sparkline", quietly = TRUE) && require("htmlwidgets", quietly = TRUE) && require("jsonlite", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # general data example data <- teal_data() data <- within(data, { @@ -73,31 +64,54 @@ data <- within(data, { faithful <- faithful CO2 <- CO2 }) -datanames(data) <- c("iris", "mtcars", "women", "faithful", "CO2") app <- init( data = data, - modules = modules(tm_variable_browser_module) + modules = modules( + tm_variable_browser( + label = "Variable browser" + ) + ) ) if (interactive()) { shinyApp(app$ui, app$server) } - +\dontshow{\}) # examplesIf} +\dontshow{if (require("sparkline", quietly = TRUE) && require("htmlwidgets", quietly = TRUE) && require("jsonlite", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # CDISC example data +library(sparkline) data <- teal_data() data <- within(data, { ADSL <- rADSL ADTTE <- rADTTE }) -datanames(data) <- c("ADSL", "ADTTE") -join_keys(data) <- default_cdisc_join_keys[datanames(data)] +join_keys(data) <- default_cdisc_join_keys[names(data)] app <- init( data = data, - modules = modules(tm_variable_browser_module) + modules = modules( + tm_variable_browser( + label = "Variable browser" + ) + ) ) if (interactive()) { shinyApp(app$ui, app$server) } - +\dontshow{\}) # examplesIf} +} +\section{Examples in Shinylive}{ +\describe{ + \item{example-1}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsKKoLADWdBBw-ri6XrRwpNSsugC89k7OtgBkGbruMb7+ABakMNQA7rT8UqSikdHecQnJqS6Z2bne+WAAVqIkdOS1MQ2JKQ4tSgDEulLhsrr8UKRQunAAHrCoIkoLSwbGXNQA+jtQNtuLy0a65aQFKuwnUSBKuro+tKJ7b4wfL7owpAILE+VwBQMYNQgr1KRHgUKuMLhfxMUFotzM1C+KLRBQxfwAwgB5ABMXyJxKUAF9FBAlGhUF8VGi-FD5hcmo8-nwhCJPilucIxCzXq9ioctCxaFB6CJDkwiKVRDJhSLXtRpXBMSl-AA1SXSkS6eWKmT+P6vGkWpQ02gmXTsFTkZiWHQ2WzPVmiO4QVgAQXQ7HpABJvFFg0rGDpGDTKUowJSALpAA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } + \item{example-2}{ + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsKKoLADWdBBw-ri6XrRwpNSsugC89k7OtgBkGbruMb7+ABakMNQA7rT8UqSikdHecQnJqS6Z2bne+WAAVqIkdOS1MQ2JKQ4tSgDEugDCACIAkgDK07pwAB6wqCK6-FCkUEp0TCwcgSFhcIoQu-sGxlzUAPo3UDZKL3e65aQFKuwvURASl0ugAgrNFgAZT6McFQ4Fg2Z2OzOGHg5GuCAAXyuXSIKkewTgrFE-z2UFsRh2cBMUGEpEeBH4tFEBEeeIJRJJwGg8FJLzkAF0lEo0KhPipaKQ-BAQR8UgCEXwhCJRE1lcIxDKQSDio8tCxaFB6CJHkwiKVRDJtTqQdRjXBqE1-AA1Q3G7bmy0yfwIkFXf1KK60Ey6dgqcjMSw6Gy2IGy3SiX4QVig9DsMUAEm8USzVsYOkYVyxSjAWMFQA}{Open in Shinylive} + \if{html}{\out{}} + \if{html}{\out{}} + } } +} + diff --git a/staged_dependencies.yaml b/staged_dependencies.yaml index 16fdd83d9..d484dfe68 100644 --- a/staged_dependencies.yaml +++ b/staged_dependencies.yaml @@ -5,6 +5,9 @@ upstream_repos: insightsengineering/nestcolor: repo: insightsengineering/nestcolor host: https://github.com + insightsengineering/roxy.shinylive: + repo: insightsengineering/roxy.shinylive + host: https://github.com insightsengineering/teal.logger: repo: insightsengineering/teal.logger host: https://github.com diff --git a/tests/testthat/helper-TealAppDriver.R b/tests/testthat/helper-TealAppDriver.R index 3e9e7cf6b..c59d7c259 100644 --- a/tests/testthat/helper-TealAppDriver.R +++ b/tests/testthat/helper-TealAppDriver.R @@ -31,22 +31,18 @@ simple_teal_data <- function() { iris <- iris mtcars <- mtcars }) - teal.data::datanames(data) <- c("iris", "mtcars") data } simple_cdisc_data <- function(datasets = c("ADSL", "ADRS", "ADTTE")) { datasets <- match.arg(datasets, several.ok = TRUE) - data <- within( - teal.data::teal_data(), - { - require(nestcolor) - ADSL <- teal.modules.general::rADSL - ADRS <- teal.modules.general::rADRS - ADTTE <- teal.modules.general::rADTTE - } + + data <- Reduce( + x = datasets, + function(u, x) eval_code(u, sprintf("%1$s <- teal.modules.general::r%1$s", x)), + init = within(teal.data::teal_data(), require(nestcolor)) ) - teal.data::datanames(data) <- datasets + teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[datasets] data } diff --git a/tests/testthat/test-shinytest2-tm_a_pca.R b/tests/testthat/test-shinytest2-tm_a_pca.R index 9c5bd6b7a..7e3badac7 100644 --- a/tests/testthat/test-shinytest2-tm_a_pca.R +++ b/tests/testthat/test-shinytest2-tm_a_pca.R @@ -5,8 +5,6 @@ app_driver_tm_a_pca <- function() { USArrests <- USArrests # nolint: object_name. }) - teal.data::datanames(data) <- "USArrests" - init_teal_app_driver( data = data, diff --git a/tests/testthat/test-shinytest2-tm_a_regression.R b/tests/testthat/test-shinytest2-tm_a_regression.R index a8e010b32..143956043 100644 --- a/tests/testthat/test-shinytest2-tm_a_regression.R +++ b/tests/testthat/test-shinytest2-tm_a_regression.R @@ -3,7 +3,6 @@ app_driver_tm_a_regression <- function() { require(nestcolor) CO2 <- CO2 # nolint: object_name. }) - teal.data::datanames(data) <- c("CO2") init_teal_app_driver( data = data, @@ -53,11 +52,11 @@ testthat::test_that("e2e - tm_a_regression: Data parameter and module label is p app_driver$expect_no_shiny_error() testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "Regression" ) - encoding_dataset <- app_driver$get_text("#teal-main_ui-root-regression .help-block") + encoding_dataset <- app_driver$get_text("#teal-teal_modules-regression .help-block") testthat::expect_match(encoding_dataset, "Dataset:[\n ]*CO2", all = FALSE) app_driver$stop() diff --git a/tests/testthat/test-shinytest2-tm_data_table.R b/tests/testthat/test-shinytest2-tm_data_table.R index 91a5b4cc2..c6330d43d 100644 --- a/tests/testthat/test-shinytest2-tm_data_table.R +++ b/tests/testthat/test-shinytest2-tm_data_table.R @@ -27,7 +27,7 @@ test_that("e2e - tm_data_table: Initializes without errors", { app_driver$expect_no_shiny_error() testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "Data Table" ) diff --git a/tests/testthat/test-shinytest2-tm_file_viewer.R b/tests/testthat/test-shinytest2-tm_file_viewer.R index 1b47cbd00..7a6eb12c6 100644 --- a/tests/testthat/test-shinytest2-tm_file_viewer.R +++ b/tests/testthat/test-shinytest2-tm_file_viewer.R @@ -34,7 +34,7 @@ test_that("e2e - tm_file_viewer: Initializes without errors and shows files tree ) testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "File Viewer Module" ) diff --git a/tests/testthat/test-shinytest2-tm_front_page.R b/tests/testthat/test-shinytest2-tm_front_page.R index 573de7288..c329db949 100644 --- a/tests/testthat/test-shinytest2-tm_front_page.R +++ b/tests/testthat/test-shinytest2-tm_front_page.R @@ -28,7 +28,7 @@ test_that("e2e - tm_front_page: Initializes without errors and check html elemen app_driver$expect_no_shiny_error() testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "Front page" ) diff --git a/tests/testthat/test-shinytest2-tm_g_association.R b/tests/testthat/test-shinytest2-tm_g_association.R index ac3c73401..b1ac33d87 100644 --- a/tests/testthat/test-shinytest2-tm_g_association.R +++ b/tests/testthat/test-shinytest2-tm_g_association.R @@ -3,10 +3,9 @@ app_driver_tm_g_association <- function() { require(nestcolor) require(ggplot2) CO2 <- CO2 # nolint: object_name. - factors <- names(Filter(isTRUE, vapply(CO2, is.factor, logical(1L)))) - CO2[factors] <- lapply(CO2[factors], as.character) # nolint: object_name. + .factors <- names(Filter(isTRUE, vapply(CO2, is.factor, logical(1L)))) + CO2[.factors] <- lapply(CO2[.factors], as.character) # nolint: object_name. }) - teal.data::datanames(data) <- c("CO2") init_teal_app_driver( data = data, @@ -52,11 +51,11 @@ testthat::test_that("e2e - tm_g_association: Data parameter and module label is app_driver$expect_no_shiny_error() testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "Association" ) - encoding_dataset <- app_driver$get_text("#teal-main_ui-root-association .help-block") + encoding_dataset <- app_driver$get_text("#teal-teal_modules-association .help-block") testthat::expect_match(encoding_dataset, "Dataset:[\n ]*CO2", all = FALSE) app_driver$stop() diff --git a/tests/testthat/test-shinytest2-tm_g_bivariate.R b/tests/testthat/test-shinytest2-tm_g_bivariate.R index 146f53a4f..9be35efe6 100644 --- a/tests/testthat/test-shinytest2-tm_g_bivariate.R +++ b/tests/testthat/test-shinytest2-tm_g_bivariate.R @@ -4,7 +4,6 @@ app_driver_tm_g_bivariate <- function() { require(nestcolor) CO2 <- data.frame(CO2) # nolint: object_name. }) - teal.data::datanames(data) <- c("CO2") init_teal_app_driver( data = data, diff --git a/tests/testthat/test-shinytest2-tm_g_distribution.R b/tests/testthat/test-shinytest2-tm_g_distribution.R index f65282719..a610aa31a 100644 --- a/tests/testthat/test-shinytest2-tm_g_distribution.R +++ b/tests/testthat/test-shinytest2-tm_g_distribution.R @@ -1,10 +1,7 @@ app_driver_tm_g_distribution <- function() { data <- teal.data::teal_data() - data <- within(data, { - ADSL <- rADSL - }) - teal.data::datanames(data) <- c("ADSL") - teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[teal.data::datanames(data)] + data <- within(data, ADSL <- rADSL) + teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[names(data)] vars1 <- teal.transform::choices_selected( teal.transform::variable_choices(data[["ADSL"]], c("ARM", "COUNTRY", "SEX")), diff --git a/tests/testthat/test-shinytest2-tm_g_response.R b/tests/testthat/test-shinytest2-tm_g_response.R index 0a8bf3f8d..4f2beb28a 100644 --- a/tests/testthat/test-shinytest2-tm_g_response.R +++ b/tests/testthat/test-shinytest2-tm_g_response.R @@ -4,8 +4,7 @@ app_driver_tm_g_response <- function() { require(nestcolor) ADSL <- rADSL }) - teal.data::datanames(data) <- c("ADSL") - teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[teal.data::datanames(data)] + teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[names(data)] init_teal_app_driver( data = data, diff --git a/tests/testthat/test-shinytest2-tm_g_scatterplot.R b/tests/testthat/test-shinytest2-tm_g_scatterplot.R index 09fd72a7b..798dc9ba0 100644 --- a/tests/testthat/test-shinytest2-tm_g_scatterplot.R +++ b/tests/testthat/test-shinytest2-tm_g_scatterplot.R @@ -4,8 +4,7 @@ app_driver_tm_g_scatterplot <- function() { require(nestcolor) ADSL <- rADSL }) - teal.data::datanames(data) <- c("ADSL") - teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[teal.data::datanames(data)] + teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[names(data)] init_teal_app_driver( data = data, diff --git a/tests/testthat/test-shinytest2-tm_g_scatterplotmatrix.R b/tests/testthat/test-shinytest2-tm_g_scatterplotmatrix.R index 1f1b6e7e9..429e67b41 100644 --- a/tests/testthat/test-shinytest2-tm_g_scatterplotmatrix.R +++ b/tests/testthat/test-shinytest2-tm_g_scatterplotmatrix.R @@ -51,11 +51,11 @@ test_that("e2e - tm_g_scatterplotmatrix: Initializes without errors", { app_driver$expect_no_shiny_error() testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "Scatterplot matrix" ) - encoding_dataset <- app_driver$get_text("#teal-main_ui-root-scatterplot_matrix .help-block") + encoding_dataset <- app_driver$get_text("#teal-teal_modules-scatterplot_matrix .help-block") testthat::expect_match(encoding_dataset, "Datasets.*ADSL.*ADRS", all = FALSE) app_driver$stop() diff --git a/tests/testthat/test-shinytest2-tm_misssing_data.R b/tests/testthat/test-shinytest2-tm_misssing_data.R index b0ac9a212..af35629ab 100644 --- a/tests/testthat/test-shinytest2-tm_misssing_data.R +++ b/tests/testthat/test-shinytest2-tm_misssing_data.R @@ -42,7 +42,7 @@ test_that("e2e - tm_missing_data: Initializes without errors", { app_driver$expect_no_shiny_error() testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "Missing data" ) diff --git a/tests/testthat/test-shinytest2-tm_outliers.R b/tests/testthat/test-shinytest2-tm_outliers.R index a846c2a8b..b2af74f0f 100644 --- a/tests/testthat/test-shinytest2-tm_outliers.R +++ b/tests/testthat/test-shinytest2-tm_outliers.R @@ -4,7 +4,6 @@ app_driver_tm_outlier <- function() { CO2 <- CO2 # nolint: object_name CO2[["primary_key"]] <- seq_len(nrow(CO2)) # nolint: object_name }) - teal.data::datanames(data) <- "CO2" teal.data::join_keys(data) <- teal.data::join_keys(join_key("CO2", "CO2", "primary_key")) vars <- teal.transform::choices_selected( @@ -56,11 +55,11 @@ testthat::test_that("e2e - tm_outliers: Data parameter and module label is passe app_driver$expect_no_shiny_error() testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "Outliers Module" ) - encoding_dataset <- app_driver$get_text("#teal-main_ui-root-outliers_module .help-block") + encoding_dataset <- app_driver$get_text("#teal-teal_modules-outliers_module .help-block") testthat::expect_match(encoding_dataset, "Dataset:[\n ]*CO2", all = FALSE) testthat::expect_match(encoding_dataset, "Outlier data points", all = FALSE) diff --git a/tests/testthat/test-shinytest2-tm_t_crosstable.R b/tests/testthat/test-shinytest2-tm_t_crosstable.R index ff47b2ed7..8c55b365d 100644 --- a/tests/testthat/test-shinytest2-tm_t_crosstable.R +++ b/tests/testthat/test-shinytest2-tm_t_crosstable.R @@ -50,11 +50,11 @@ test_that("e2e - tm_t_crosstable: Initializes without errors", { app_driver$expect_no_shiny_error() testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "Cross Table" ) - encoding_dataset <- app_driver$get_text("#teal-main_ui-root-cross_table .help-block") + encoding_dataset <- app_driver$get_text("#teal-teal_modules-cross_table .help-block") testthat::expect_match(encoding_dataset, "Dataset:\\n *ADSL\\n", all = FALSE) app_driver$stop() diff --git a/tests/testthat/test-shinytest2-tm_variable_browser.R b/tests/testthat/test-shinytest2-tm_variable_browser.R index a81aa2acb..abf5680f8 100644 --- a/tests/testthat/test-shinytest2-tm_variable_browser.R +++ b/tests/testthat/test-shinytest2-tm_variable_browser.R @@ -10,18 +10,18 @@ app_driver_tm_variable_browser <- function() { CO2 <- CO2 # nolint: object_name. } ) - teal.data::datanames(data) <- c("iris", "mtcars", "women", "faithful", "CO2") init_teal_app_driver( data = data, modules = tm_variable_browser( label = "Variable browser (e2e)", + datasets_selected = c("iris", "mtcars", "women", "faithful", "CO2"), parent_dataname = "CO2", ggplot2_args = teal.widgets::ggplot2_args( labs = list(subtitle = "Plot generated by Variable Browser Module") ), pre_output = shiny::tags$div("A pre-output message for tm_variable_browser"), - post_output = shiny::tags$div("A post-output message for tm_variable_browser"), + post_output = shiny::tags$div("A post-output message for tm_variable_browser") ) ) } @@ -35,7 +35,7 @@ testthat::test_that("e2e - tm_variable_browser: content is displayed correctly." # Test tab name testthat::expect_equal( - trimws(app_driver$get_text("#teal-main_ui-root-active_tab > li.active")), + trimws(app_driver$get_text("#teal-teal_modules-active_tab > li.active")), "Variable browser (e2e)" ) diff --git a/vignettes/teal-modules-general.Rmd b/vignettes/teal-modules-general.Rmd index 4ccb9a329..867fba79a 100644 --- a/vignettes/teal-modules-general.Rmd +++ b/vignettes/teal-modules-general.Rmd @@ -10,16 +10,16 @@ vignette: > ### Introduction -`teal` extends the `shiny` framework, enabling the creation of interactive GUI applications using the `R`. -`shiny`, and `teal`facilitate the development of extensive applications through combining small, decoupled modules. -The `teal.modules.general` package consist of collection of modules essential for developing `teal` applications. -It is "general" in the sense that the intended functions of these modules are more fundamental. This contrasts with the more specialized focus on clinical data found in the `teal.modules.clinical` package. +`teal` extends the `shiny` framework, enabling the creation of interactive GUI applications using the `R`. +`shiny`, and `teal`facilitate the development of extensive applications through combining small, decoupled modules. +The `teal.modules.general` package consist of collection of modules essential for developing `teal` applications. +It is "general" in the sense that the intended functions of these modules are more fundamental. This contrasts with the more specialized focus on clinical data found in the `teal.modules.clinical` package. The modules from `teal.modules.general` can be used in conjunction with modules from `teal.modules.clinical` and / or other `shiny` modules to build a large `teal` / `shiny` app. The concepts presented here require knowledge about the core features of `teal`, specifically on how to launch a `teal` -application and how to pass data into it. Therefore, it is highly recommended to refer to the [`README`](https://insightsengineering.github.io/teal/index.html) file and +application and how to pass data into it. Therefore, it is highly recommended to refer to the [`README`](https://insightsengineering.github.io/teal/index.html) file and the introductory [vignette](https://insightsengineering.github.io/teal/latest-tag/articles/getting-started-with-teal.html) of the `teal` package. See also `teal.modules.clinical`'s [`README`](https://insightsengineering.github.io/teal.modules.clinical/latest-tag/index.html). @@ -39,10 +39,11 @@ See [package functions / modules](https://insightsengineering.github.io/teal.mod ### Example application A simple application featuring the `tm_variable_browser()` module: -```{r, message = FALSE, results = "hide"} +```{r app, message = FALSE, results = "hide", eval = requireNamespace("sparkline", quietly = TRUE)} # load libraries library(teal.modules.general) library(teal.widgets) +library(sparkline) # teal_data object data <- teal_data() @@ -50,9 +51,7 @@ data <- within(data, { ADSL <- rADSL ADTTE <- rADTTE }) -datanames <- c("ADSL", "ADTTE") -datanames(data) <- datanames -join_keys(data) <- default_cdisc_join_keys[datanames] +join_keys(data) <- default_cdisc_join_keys[names(data)] # tm_variable_browser module tm_variable_browser_module <- tm_variable_browser( @@ -69,12 +68,28 @@ app <- init( ) ``` -```{r, eval = FALSE} +```{r shinyapp, eval = FALSE} shinyApp(app$ui, app$server) ``` +### Try it out in Shinylive + +```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)} +code <- paste0(c( + knitr::knit_code$get("app"), + knitr::knit_code$get("shinyapp") +), collapse = "\n") + +url <- roxy.shinylive::create_shinylive_url(code) +cat(sprintf("[Open in Shinylive](%s)\n\n", url)) +``` + +```{r shinylive_iframe, echo = FALSE, out.width = '150%', out.extra = 'style = "position: relative; z-index:1"', eval = requireNamespace("roxy.shinylive", quietly = TRUE) && knitr::is_html_output() && identical(Sys.getenv("IN_PKGDOWN"), "true")} +knitr::include_url(url, height = "800px") +``` + Let's break the above app into pieces: 1: Load the necessary libraries and data. @@ -94,9 +109,7 @@ data <- within(data, { ADSL <- rADSL ADTTE <- rADTTE }) -datanames <- c("ADSL", "ADTTE") -datanames(data) <- datanames -join_keys(data) <- default_cdisc_join_keys[datanames] +join_keys(data) <- default_cdisc_join_keys[names(data)] ``` 3: Initialize a `teal` application with specified data and modules, in this case, the module: `tm_variable_browser`, datasets:`ADSL` and `ADTTE`. @@ -129,7 +142,7 @@ In a `teal` app, data and modules are decoupled. In the app above: - The app developer specified the module and assigned it to the `modules` argument. - The `init` function took these arguments and returned a list containing `ui` and `server` object, which can be demonstrated by running: -```{r, indent = " "} +```{r, indent = " ", eval = requireNamespace("sparkline", quietly = TRUE)} class(app) names(app) ``` diff --git a/vignettes/using-association-plot.Rmd b/vignettes/using-association-plot.Rmd index dc4660cb8..9927d6689 100644 --- a/vignettes/using-association-plot.Rmd +++ b/vignettes/using-association-plot.Rmd @@ -19,7 +19,7 @@ This vignette will guide you through the four parts to create a `teal` applicati ## 1 - Load libraries -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r library, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} library(teal.modules.general) # used to create the app library(dplyr) # used to modify data sets ``` @@ -33,7 +33,7 @@ Inside this app 4 datasets will be used 3. `ADTTE` A long data set with time to event data 4. `ADLB` A long data set with lab measurements for each subject -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r data, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} data <- teal_data() data <- within(data, { ADSL <- teal.modules.general::rADSL %>% @@ -47,16 +47,14 @@ data <- within(data, { TRUE ~ "-" ))) }) -datanames <- c("ADSL", "ADRS", "ADTTE", "ADLB") -datanames(data) <- datanames -join_keys(data) <- default_cdisc_join_keys[datanames] +join_keys(data) <- default_cdisc_join_keys[names(data)] ``` ## 3 - Create an `app` variable This is the most important section. We will use the `teal::init()` function to create an app. The data will be handed over using `teal.data::teal_data()`. The app itself will be constructed by multiple calls of `tm_g_association()` using different combinations of data sets. -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r app, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} # configuration for a single wide dataset mod1 <- tm_g_association( label = "Single wide dataset", @@ -296,8 +294,26 @@ app <- init( A simple `shiny::shinyApp()` call will let you run the app. Note that app is only displayed when running this code inside an `R` session. -```{r, echo=TRUE, results="hide", eval=base::interactive()} +```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()} shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024)) ``` + +## 5 - Try it out in Shinylive + +```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)} +code <- paste0(c( + knitr::knit_code$get("library"), + knitr::knit_code$get("data"), + knitr::knit_code$get("app"), + knitr::knit_code$get("shinyapp") +), collapse = "\n") + +url <- roxy.shinylive::create_shinylive_url(code) +cat(sprintf("[Open in Shinylive](%s)\n\n", url)) +``` + +```{r shinylive_iframe, echo = FALSE, out.width = '150%', out.extra = 'style = "position: relative; z-index:1"', eval = requireNamespace("roxy.shinylive", quietly = TRUE) && knitr::is_html_output() && identical(Sys.getenv("IN_PKGDOWN"), "true")} +knitr::include_url(url, height = "800px") +``` diff --git a/vignettes/using-bivariate-plot.Rmd b/vignettes/using-bivariate-plot.Rmd index 518692b38..7267ae1ca 100644 --- a/vignettes/using-bivariate-plot.Rmd +++ b/vignettes/using-bivariate-plot.Rmd @@ -20,7 +20,7 @@ various types of datasets using the bivariate plot module `tm_g_bivariate()`: ## 1 - Load libraries -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r library, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} library(teal.modules.general) # used to create the app library(dplyr) # used to modify data sets ``` @@ -35,7 +35,7 @@ Inside this app 4 datasets will be used 3. `ADTTE` A long data set with time to event data 4. `ADLB` A long data set with lab measurements for each subject -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r data, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} data <- teal_data() data <- within(data, { ADSL <- teal.modules.general::rADSL %>% @@ -49,9 +49,7 @@ data <- within(data, { TRUE ~ "-" ))) }) -datanames <- c("ADSL", "ADRS", "ADTTE", "ADLB") -datanames(data) <- datanames -join_keys(data) <- default_cdisc_join_keys[datanames] +join_keys(data) <- default_cdisc_join_keys[names(data)] ``` ## 3 - Create an `app` variable @@ -61,7 +59,7 @@ create an app. The data will be handed over using `teal.data::teal_data()`. The itself will be constructed by multiple calls of `tm_g_bivariate()` using different combinations of data sets. -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r app, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} # configuration for the single wide dataset mod1 <- tm_g_bivariate( label = "Single wide dataset", @@ -622,8 +620,26 @@ app <- init( A simple `shiny::shinyApp()` call will let you run the app. Note that app is only displayed when running this code inside an `R` session. -```{r, echo=TRUE, results="hide", eval=base::interactive()} +```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()} shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024)) ``` + +## 5 - Try it out in Shinylive + +```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)} +code <- paste0(c( + knitr::knit_code$get("library"), + knitr::knit_code$get("data"), + knitr::knit_code$get("app"), + knitr::knit_code$get("shinyapp") +), collapse = "\n") + +url <- roxy.shinylive::create_shinylive_url(code) +cat(sprintf("[Open in Shinylive](%s)\n\n", url)) +``` + +```{r shinylive_iframe, echo = FALSE, out.width = '150%', out.extra = 'style = "position: relative; z-index:1"', eval = requireNamespace("roxy.shinylive", quietly = TRUE) && knitr::is_html_output() && identical(Sys.getenv("IN_PKGDOWN"), "true")} +knitr::include_url(url, height = "800px") +``` diff --git a/vignettes/using-cross-table.Rmd b/vignettes/using-cross-table.Rmd index fd0c98b6d..552976eeb 100644 --- a/vignettes/using-cross-table.Rmd +++ b/vignettes/using-cross-table.Rmd @@ -20,9 +20,10 @@ various types of datasets using the cross table module `tm_t_crosstable()`: ## 1 - Load libraries -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r library, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} library(teal.modules.general) # used to create the app library(dplyr) # used to modify data sets +library(rtables) ``` ## 2 - Create data sets @@ -32,7 +33,7 @@ Inside this app 2 datasets will be used 1. `ADSL` A wide data set with subject data 2. `ADLB` A long data set with lab measurements for each subject -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide", echo=2:6} +```{r data, echo=TRUE, message=FALSE, warning=FALSE, results="hide", echo=2:6} data <- teal_data() data <- within(data, { ADSL <- teal.modules.general::rADSL @@ -43,9 +44,7 @@ data <- within(data, { TRUE ~ "-" ))) }) -datanames <- c("ADSL", "ADLB") -datanames(data) <- datanames -join_keys(data) <- default_cdisc_join_keys[datanames] +join_keys(data) <- default_cdisc_join_keys[names(data)] ``` ## 3 - Create an `app` variable @@ -55,7 +54,7 @@ create an app. The data will be handed over using `teal.data::teal_data()`. The itself will be constructed by multiple calls of `tm_t_crosstable()` using different combinations of data sets. -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r app, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} # configuration for the single wide dataset mod1 <- tm_t_crosstable( label = "Single wide dataset", @@ -138,8 +137,26 @@ app <- init( A simple `shiny::shinyApp()` call will let you run the app. Note that app is only displayed when running this code inside an `R` session. -```{r, echo=TRUE, results="hide", eval=base::interactive()} +```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()} shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024)) ``` + +## 5 - Try it out in Shinylive + +```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)} +code <- paste0(c( + knitr::knit_code$get("library"), + knitr::knit_code$get("data"), + knitr::knit_code$get("app"), + knitr::knit_code$get("shinyapp") +), collapse = "\n") + +url <- roxy.shinylive::create_shinylive_url(code) +cat(sprintf("[Open in Shinylive](%s)\n\n", url)) +``` + +```{r shinylive_iframe, echo = FALSE, out.width = '150%', out.extra = 'style = "position: relative; z-index:1"', eval = requireNamespace("roxy.shinylive", quietly = TRUE) && knitr::is_html_output() && identical(Sys.getenv("IN_PKGDOWN"), "true")} +knitr::include_url(url, height = "800px") +``` diff --git a/vignettes/using-data-table.Rmd b/vignettes/using-data-table.Rmd index c1a34f450..d9ca029d8 100644 --- a/vignettes/using-data-table.Rmd +++ b/vignettes/using-data-table.Rmd @@ -20,7 +20,7 @@ various types of datasets using the data table module `tm_data_table()`: ## 1 - Load libraries -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r library, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} library(teal.modules.general) # used to create the app ``` @@ -32,16 +32,14 @@ Inside this app 3 datasets will be used 2. `ADTTE` A long data set with time to event data 3. `ADLB` A long data set with lab measurements for each subject -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r data, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} data <- teal_data() data <- within(data, { ADSL <- teal.modules.general::rADSL ADTTE <- teal.modules.general::rADTTE ADLB <- teal.modules.general::rADLB }) -datanames <- c("ADSL", "ADTTE", "ADLB") -datanames(data) <- datanames -join_keys(data) <- default_cdisc_join_keys[datanames] +join_keys(data) <- default_cdisc_join_keys[names(data)] ``` ## 3 - Create an `app` variable @@ -51,7 +49,7 @@ create an app. The data will be handed over using `teal.data::teal_data()`. The app itself will be constructed by multiple calls of `tm_data_table()` using different combinations of data sets. -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r app, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} # configuration for the two-datasets example mod1 <- tm_data_table( label = "Two datasets", @@ -106,11 +104,29 @@ app <- init( ## 4 - Run the app -A simple `shiny::shinyApp()` call will let you run the app. -Note that app is only displayed when running this code inside an `R` session. +A simple `shiny::shinyApp()` call will let you run the app. +Note that app is only displayed when running this code inside an `R` session. -```{r, echo=TRUE, results="hide", eval=base::interactive()} +```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()} shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024)) ``` + +## 5 - Try it out in Shinylive + +```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)} +code <- paste0(c( + knitr::knit_code$get("library"), + knitr::knit_code$get("data"), + knitr::knit_code$get("app"), + knitr::knit_code$get("shinyapp") +), collapse = "\n") + +url <- roxy.shinylive::create_shinylive_url(code) +cat(sprintf("[Open in Shinylive](%s)\n\n", url)) +``` + +```{r shinylive_iframe, echo = FALSE, out.width = '150%', out.extra = 'style = "position: relative; z-index:1"', eval = requireNamespace("roxy.shinylive", quietly = TRUE) && knitr::is_html_output() && identical(Sys.getenv("IN_PKGDOWN"), "true")} +knitr::include_url(url, height = "800px") +``` diff --git a/vignettes/using-outliers-module.Rmd b/vignettes/using-outliers-module.Rmd index 9ed56f0ad..5271906e5 100644 --- a/vignettes/using-outliers-module.Rmd +++ b/vignettes/using-outliers-module.Rmd @@ -20,7 +20,7 @@ various types of datasets using the outliers module `tm_outliers()`: ## 1 - Load libraries -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r library, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} library(teal.modules.general) # used to create the app library(dplyr) # used to modify data sets ``` @@ -33,16 +33,14 @@ Inside this app 3 datasets will be used 2. `ADRS` A long data set with response data for subjects at different time points of the study 3. `ADLB` A long data set with lab measurements for each subject -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r data, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} data <- teal_data() data <- within(data, { ADSL <- teal.modules.general::rADSL ADRS <- teal.modules.general::rADRS ADLB <- teal.modules.general::rADLB }) -datanames <- c("ADSL", "ADRS", "ADLB") -datanames(data) <- datanames -join_keys(data) <- default_cdisc_join_keys[datanames] +join_keys(data) <- default_cdisc_join_keys[names(data)] ``` ## 3 - Create an `app` variable @@ -52,7 +50,7 @@ create an app. The data will be handed over using `teal.data::teal_data()`. The itself will be constructed by multiple calls of `tm_outliers()` using different combinations of data sets. -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r app, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} # configuration for the single wide dataset mod1 <- tm_outliers( label = "Single wide dataset", @@ -187,11 +185,29 @@ app <- init( ``` ## 4 - Run the app -A simple `shiny::shinyApp()` call will let you run the app. -Note that app is only displayed when running this code inside an `R` session. +A simple `shiny::shinyApp()` call will let you run the app. +Note that app is only displayed when running this code inside an `R` session. -```{r, echo=TRUE, results="hide", eval=base::interactive()} +```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()} shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024)) ``` + +## 5 - Try it out in Shinylive + +```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)} +code <- paste0(c( + knitr::knit_code$get("library"), + knitr::knit_code$get("data"), + knitr::knit_code$get("app"), + knitr::knit_code$get("shinyapp") +), collapse = "\n") + +url <- roxy.shinylive::create_shinylive_url(code) +cat(sprintf("[Open in Shinylive](%s)\n\n", url)) +``` + +```{r shinylive_iframe, echo = FALSE, out.width = '150%', out.extra = 'style = "position: relative; z-index:1"', eval = requireNamespace("roxy.shinylive", quietly = TRUE) && knitr::is_html_output() && identical(Sys.getenv("IN_PKGDOWN"), "true")} +knitr::include_url(url, height = "800px") +``` diff --git a/vignettes/using-regression-plots.Rmd b/vignettes/using-regression-plots.Rmd index 93d901012..02677ad6d 100644 --- a/vignettes/using-regression-plots.Rmd +++ b/vignettes/using-regression-plots.Rmd @@ -21,7 +21,7 @@ various types of datasets using the regression plot module `tm_a_regression()`: ## 1 - Load libraries -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r library, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} library(teal.modules.general) # used to create the app library(dplyr) # used to modify data sets ``` @@ -35,7 +35,7 @@ Inside this app 4 datasets will be used 3. `ADTTE` A long data set with time to event data 4. `ADLB` A long data set with lab measurements for each subject -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r data, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} data <- teal_data() data <- within(data, { ADSL <- teal.modules.general::rADSL %>% @@ -49,9 +49,7 @@ data <- within(data, { TRUE ~ "-" ))) }) -datanames <- c("ADSL", "ADRS", "ADTTE", "ADLB") -datanames(data) <- datanames -join_keys(data) <- default_cdisc_join_keys[datanames] +join_keys(data) <- default_cdisc_join_keys[names(data)] ``` ## 3 - Create an `app` variable @@ -61,7 +59,7 @@ create an app. The data will be handed over using `teal.data::teal_data()`. The itself will be constructed by multiple calls of `tm_a_regression()` using different combinations of data sets. -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r app, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} # configuration for the single wide dataset mod1 <- tm_a_regression( label = "Single wide dataset", @@ -269,8 +267,26 @@ app <- init( A simple `shiny::shinyApp()` call will let you run the app. Note that app is only displayed when running this code inside an `R` session. -```{r, echo=TRUE, results="hide", eval=base::interactive()} +```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()} shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024)) ``` + +## 5 - Try it out in Shinylive + +```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)} +code <- paste0(c( + knitr::knit_code$get("library"), + knitr::knit_code$get("data"), + knitr::knit_code$get("app"), + knitr::knit_code$get("shinyapp") +), collapse = "\n") + +url <- roxy.shinylive::create_shinylive_url(code) +cat(sprintf("[Open in Shinylive](%s)\n\n", url)) +``` + +```{r shinylive_iframe, echo = FALSE, out.width = '150%', out.extra = 'style = "position: relative; z-index:1"', eval = requireNamespace("roxy.shinylive", quietly = TRUE) && knitr::is_html_output() && identical(Sys.getenv("IN_PKGDOWN"), "true")} +knitr::include_url(url, height = "800px") +``` diff --git a/vignettes/using-response-plot.Rmd b/vignettes/using-response-plot.Rmd index 415f095f7..af452ee15 100644 --- a/vignettes/using-response-plot.Rmd +++ b/vignettes/using-response-plot.Rmd @@ -20,7 +20,7 @@ various types of datasets using the response plot module `tm_g_response()`: ## 1 - Load libraries -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r library, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} library(teal.modules.general) # used to create the app library(dplyr) # used to modify data sets ``` @@ -34,7 +34,7 @@ Inside this app 4 datasets will be used 3. `ADTTE` A long data set with time to event data 4. `ADLB` A long data set with lab measurements for each subject -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r data, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} data <- teal_data() data <- within(data, { ADSL <- teal.modules.general::rADSL %>% @@ -48,9 +48,7 @@ data <- within(data, { TRUE ~ "-" ))) }) -datanames <- c("ADSL", "ADRS", "ADTTE", "ADLB") -datanames(data) <- datanames -join_keys(data) <- default_cdisc_join_keys[datanames] +join_keys(data) <- default_cdisc_join_keys[names(data)] ``` ## 3 - Create an `app` variable @@ -60,7 +58,7 @@ create an app. The data will be handed over using `teal.data::teal_data()`. The itself will be constructed by multiple calls of `tm_g_response()` using different combinations of data sets. -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r app, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} # configuration for the single wide dataset mod1 <- tm_g_response( label = "Single wide dataset", @@ -378,8 +376,26 @@ app <- init( A simple `shiny::shinyApp()` call will let you run the app. Note that app is only displayed when running this code inside an `R` session. -```{r, echo=TRUE, results="hide", eval=base::interactive()} +```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()} shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024)) ``` + +## 5 - Try it out in Shinylive + +```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)} +code <- paste0(c( + knitr::knit_code$get("library"), + knitr::knit_code$get("data"), + knitr::knit_code$get("app"), + knitr::knit_code$get("shinyapp") +), collapse = "\n") + +url <- roxy.shinylive::create_shinylive_url(code) +cat(sprintf("[Open in Shinylive](%s)\n\n", url)) +``` + +```{r shinylive_iframe, echo = FALSE, out.width = '150%', out.extra = 'style = "position: relative; z-index:1"', eval = requireNamespace("roxy.shinylive", quietly = TRUE) && knitr::is_html_output() && identical(Sys.getenv("IN_PKGDOWN"), "true")} +knitr::include_url(url, height = "800px") +``` diff --git a/vignettes/using-scatterplot-matrix.Rmd b/vignettes/using-scatterplot-matrix.Rmd index befb643fb..de15d7d4a 100644 --- a/vignettes/using-scatterplot-matrix.Rmd +++ b/vignettes/using-scatterplot-matrix.Rmd @@ -21,9 +21,10 @@ various types of datasets using the scatter plot matrix module `tm_g_scatterplot ## 1 - Load libraries -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r library, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} library(teal.modules.general) # used to create the app library(dplyr) # used to modify data sets +library(lattice) ``` ## 2 - Create data sets @@ -35,7 +36,7 @@ Inside this app 4 datasets will be used 3. `ADTTE` A long data set with time to event data 4. `ADLB` A long data set with lab measurements for each subject -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r data, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} data <- teal_data() data <- within(data, { ADSL <- teal.modules.general::rADSL %>% @@ -49,9 +50,7 @@ data <- within(data, { TRUE ~ "-" ))) }) -datanames <- c("ADSL", "ADRS", "ADTTE", "ADLB") -datanames(data) <- datanames -join_keys(data) <- default_cdisc_join_keys[datanames] +join_keys(data) <- default_cdisc_join_keys[names(data)] ``` ## 3 - Create an `app` variable @@ -61,7 +60,7 @@ create an app. The data will be handed over using `teal.data::teal_data()`. The itself will be constructed by multiple calls of `tm_g_scatterplotmatrix()` using different combinations of data sets. -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r app, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} # configuration for the single wide dataset mod1 <- tm_g_scatterplotmatrix( label = "Single wide dataset", @@ -156,8 +155,26 @@ app <- init( A simple `shiny::shinyApp()` call will let you run the app. Note that app is only displayed when running this code inside an `R` session. -```{r, echo=TRUE, results="hide", eval=base::interactive()} +```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()} shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024)) ``` + +## 5 - Try it out in Shinylive + +```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)} +code <- paste0(c( + knitr::knit_code$get("library"), + knitr::knit_code$get("data"), + knitr::knit_code$get("app"), + knitr::knit_code$get("shinyapp") +), collapse = "\n") + +url <- roxy.shinylive::create_shinylive_url(code) +cat(sprintf("[Open in Shinylive](%s)\n\n", url)) +``` + +```{r shinylive_iframe, echo = FALSE, out.width = '150%', out.extra = 'style = "position: relative; z-index:1"', eval = requireNamespace("roxy.shinylive", quietly = TRUE) && knitr::is_html_output() && identical(Sys.getenv("IN_PKGDOWN"), "true")} +knitr::include_url(url, height = "800px") +``` diff --git a/vignettes/using-scatterplot.Rmd b/vignettes/using-scatterplot.Rmd index 58e42ef92..f6379d976 100644 --- a/vignettes/using-scatterplot.Rmd +++ b/vignettes/using-scatterplot.Rmd @@ -21,9 +21,12 @@ various types of datasets using the scatter plot module `tm_g_scatterplot()`: ## 1 - Load libraries -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r library, echo=TRUE, message=FALSE, warning=FALSE, results="hide", eval = requireNamespace("ggpmics") && requireNamespace("ggExtra") && requireNamespace("colourpicker")} library(teal.modules.general) # used to create the app library(dplyr) # used to modify data sets +library(ggpmisc) +library(ggExtra) +library(colourpicker) ``` ## 2 - Create data sets @@ -35,7 +38,7 @@ Inside this app 4 datasets will be used 3. `ADTTE` A long data set with time to event data 4. `ADLB` A long data set with lab measurements for each subject -```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r data, echo=TRUE, message=FALSE, warning=FALSE, results="hide", eval = requireNamespace("ggpmics") && requireNamespace("ggExtra") && requireNamespace("colourpicker")} data <- teal_data() data <- within(data, { ADSL <- teal.modules.general::rADSL %>% @@ -49,9 +52,7 @@ data <- within(data, { TRUE ~ "-" ))) }) -datanames <- c("ADSL", "ADRS", "ADTTE", "ADLB") -datanames(data) <- datanames -join_keys(data) <- default_cdisc_join_keys[datanames] +join_keys(data) <- default_cdisc_join_keys[names(data)] ``` ## 3 - Create an `app` variable @@ -61,13 +62,7 @@ create an app. The data will be handed over using `teal.data::teal_data()`. The itself will be constructed by multiple calls of `tm_g_scatterplot()` using different combinations of data sets. -```{r ggExtra, include = FALSE} -ggextra_available <- requireNamespace("ggExtra", quietly = TRUE) -``` -```{r, include = !ggextra_available} -# NOTE: The code will not be run as package ggExtra is not installed. -``` -```{r, eval = ggextra_available, echo=TRUE, message=FALSE, warning=FALSE, results="hide"} +```{r app, echo=TRUE, message=FALSE, warning=FALSE, results="hide", eval = requireNamespace("ggpmics") && requireNamespace("ggExtra") && requireNamespace("colourpicker")} # configuration for the single wide datasets mod1 <- tm_g_scatterplot( label = "Single wide dataset", @@ -376,8 +371,26 @@ app <- init( A simple `shiny::shinyApp()` call will let you run the app. Note that app is only displayed when running this code inside an `R` session. -```{r, echo=TRUE, results="hide", eval=base::interactive()} +```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()} shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024)) ``` + +## 5 - Try it out in Shinylive + +```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)} +code <- paste0(c( + knitr::knit_code$get("library"), + knitr::knit_code$get("data"), + knitr::knit_code$get("app"), + knitr::knit_code$get("shinyapp") +), collapse = "\n") + +url <- roxy.shinylive::create_shinylive_url(code) +cat(sprintf("[Open in Shinylive](%s)\n\n", url)) +``` + +```{r shinylive_iframe, echo = FALSE, out.width = '150%', out.extra = 'style = "position: relative; z-index:1"', eval = requireNamespace("roxy.shinylive", quietly = TRUE) && knitr::is_html_output() && identical(Sys.getenv("IN_PKGDOWN"), "true")} +knitr::include_url(url, height = "800px") +```