diff --git a/.lintr b/.lintr index 0a0bb22f3..6eb605825 100644 --- a/.lintr +++ b/.lintr @@ -4,3 +4,35 @@ linters: linters_with_defaults( object_usage_linter = NULL, indentation_linter = NULL ) +exclusions: list( + "vignettes/teal-modules-general.Rmd" = list( + object_name_linter = Inf + ), + "vignettes/using-association-plot.Rmd" = list( + object_name_linter = Inf + ), + "vignettes/using-bivariate-plot.Rmd" = list( + object_name_linter = Inf + ), + "vignettes/using-cross-table.Rmd" = list( + object_name_linter = Inf + ), + "vignettes/using-data-table.Rmd" = list( + object_name_linter = Inf + ), + "vignettes/using-outliers-module.Rmd" = list( + object_name_linter = Inf + ), + "vignettes/using-regression-plots.Rmd" = list( + object_name_linter = Inf + ), + "vignettes/using-response-plot.Rmd" = list( + object_name_linter = Inf + ), + "vignettes/using-scatterplot-matrix.Rmd" = list( + object_name_linter = Inf + ), + "vignettes/using-scatterplot.Rmd" = list( + object_name_linter = Inf + ) + ) diff --git a/DESCRIPTION b/DESCRIPTION index 27ca55e99..723621361 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -65,26 +65,27 @@ Suggests: rtables (>= 0.5.1), sparkline, teal.data (>= 0.3.0.9018), - testthat (>= 3.0.4) + testthat (>= 3.0.4), + withr (>= 2.0.0) VignetteBuilder: knitr Config/Needs/verdepcheck: haleyjeppson/ggmosaic, tidyverse/ggplot2, - rstudio/shiny, shinyTree/shinyTree, insightsengineering/teal, + rstudio/shiny, shinyTree/shinyTree, insightsengineering/teal, insightsengineering/teal.transform, mllg/checkmate, tidyverse/dplyr, rstudio/DT, tidyverse/forcats, daroczig/logger, tidyverse/magrittr, r-lib/scales, daattali/shinyjs, rstudio/shinyvalidate, dreamRs/shinyWidgets, tidyverse/stringr, insightsengineering/teal.code, insightsengineering/teal.logger, - insightsengineering/teal.reporter, insightsengineering/teal.transform, + insightsengineering/teal.reporter, insightsengineering/teal.widgets, insightsengineering/tern, tidyverse/tibble, tidyverse/tidyr, r-lib/tidyselect, tidymodels/broom, daattali/colourpicker, daattali/ggExtra, aphalo/ggpmisc, aphalo/ggpp, baddstats/goftest, gridExtra, ramnathv/htmlwidgets, jeroen/jsonlite, yihui/knitr, deepayan/lattice, MASS, insightsengineering/nestcolor, r-lib/rlang, insightsengineering/rtables, sparkline, - insightsengineering/teal.data, r-lib/testthat + insightsengineering/teal.data, 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.2.3 +RoxygenNote: 7.3.0 diff --git a/R/teal.modules.general.R b/R/teal.modules.general.R index 0df71c52c..6813b2dee 100644 --- a/R/teal.modules.general.R +++ b/R/teal.modules.general.R @@ -12,10 +12,8 @@ #' @importFrom magrittr %>% #' #' -#' @docType package -#' @name teal.modules.general #' @keywords internal -NULL +"_PACKAGE" # nolint start # Note ggmosaic (version <= 0.3.3) needs to be in DEPENDS as the following does not work if it is imported diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index 1606862a8..04406baf1 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -21,26 +21,26 @@ #' @export #' #' @examples -#' #' # ADSL example #' #' data <- teal_data() #' data <- within(data, { #' library(nestcolor) -#' ADSL <- teal.modules.general::rADSL +#' ADSL <- rADSL #' }) #' datanames <- c("ADSL") #' datanames(data) <- datanames #' join_keys(data) <- default_cdisc_join_keys[datanames] -#' app <- teal::init( +#' +#' app <- init( #' data = data, -#' modules = teal::modules( -#' teal.modules.general::tm_a_pca( +#' modules = modules( +#' tm_a_pca( #' "PCA", -#' dat = teal.transform::data_extract_spec( +#' dat = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( -#' choices = teal.transform::variable_choices( +#' select = select_spec( +#' choices = variable_choices( #' data = data[["ADSL"]], c("BMRKR1", "AGE", "EOSDY") #' ), #' selected = c("BMRKR1", "AGE"), diff --git a/R/tm_a_regression.R b/R/tm_a_regression.R index 34e25eee3..d1aa991c2 100644 --- a/R/tm_a_regression.R +++ b/R/tm_a_regression.R @@ -37,20 +37,20 @@ #' data <- teal_data() #' data <- within(data, { #' library(nestcolor) -#' ADSL <- teal.modules.general::rADSL +#' ADSL <- rADSL #' }) #' datanames <- c("ADSL") #' datanames(data) <- datanames #' join_keys(data) <- default_cdisc_join_keys[datanames] #' -#' app <- teal::init( +#' app <- init( #' data = data, -#' modules = teal::modules( -#' teal.modules.general::tm_a_regression( +#' modules = modules( +#' tm_a_regression( #' label = "Regression", -#' response = teal.transform::data_extract_spec( +#' response = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variable:", #' choices = "BMRKR1", #' selected = "BMRKR1", @@ -58,11 +58,11 @@ #' fixed = TRUE #' ) #' ), -#' regressor = teal.transform::data_extract_spec( +#' regressor = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variables:", -#' choices = teal.transform::variable_choices(data[["ADSL"]], c("AGE", "SEX", "RACE")), +#' choices = variable_choices(data[["ADSL"]], c("AGE", "SEX", "RACE")), #' selected = "AGE", #' multiple = TRUE, #' fixed = FALSE diff --git a/R/tm_data_table.R b/R/tm_data_table.R index ad20cc078..3efeb370f 100644 --- a/R/tm_data_table.R +++ b/R/tm_data_table.R @@ -27,20 +27,19 @@ #' Note though that sorting of numeric columns with `NA`/`Inf` will be lexicographic not numerical. #' @export #' @examples -#' #' data <- teal_data() #' data <- within(data, { #' library(nestcolor) -#' ADSL <- teal.modules.general::rADSL +#' ADSL <- rADSL #' }) #' datanames <- c("ADSL") #' datanames(data) <- datanames #' join_keys(data) <- default_cdisc_join_keys[datanames] #' -#' app <- teal::init( +#' app <- init( #' data = data, -#' modules = teal::modules( -#' teal.modules.general::tm_data_table( +#' modules = modules( +#' tm_data_table( #' variables_selected = list(ADSL = c("STUDYID", "USUBJID", "SUBJID", "SITEID", "AGE", "SEX")), #' dt_args = list(caption = "ADSL Table Caption") #' ) diff --git a/R/tm_file_viewer.R b/R/tm_file_viewer.R index deb5632a0..c2295a148 100644 --- a/R/tm_file_viewer.R +++ b/R/tm_file_viewer.R @@ -19,10 +19,10 @@ #' }) #' datanames(data) <- c("data") #' -#' app <- teal::init( +#' app <- init( #' data = data, -#' modules = teal::modules( -#' teal.modules.general::tm_file_viewer( +#' modules = modules( +#' tm_file_viewer( #' input_path = list( #' folder = system.file("sample_files", package = "teal.modules.general"), #' png = system.file("sample_files/sample_file.png", package = "teal.modules.general"), diff --git a/R/tm_front_page.R b/R/tm_front_page.R index aa755d64f..e6ada1dc5 100644 --- a/R/tm_front_page.R +++ b/R/tm_front_page.R @@ -16,11 +16,10 @@ #' @return A `teal` module to be used in `teal` applications #' @export #' @examples -#' #' data <- teal_data() #' data <- within(data, { #' library(nestcolor) -#' ADSL <- teal.modules.general::rADSL +#' ADSL <- rADSL #' attr(ADSL, "metadata") <- list("Author" = "NEST team", "data_source" = "synthetic data") #' }) #' datanames <- c("ADSL") @@ -37,10 +36,10 @@ #' "Table 3" = table_3 #' ) #' -#' app <- teal::init( +#' app <- init( #' data = data, -#' modules = teal::modules( -#' teal.modules.general::tm_front_page( +#' modules = modules( +#' tm_front_page( #' header_text = c( #' "Important information" = "It can go here.", #' "Other information" = "Can go here." diff --git a/R/tm_g_association.R b/R/tm_g_association.R index 2a4bf5625..97463a5f5 100644 --- a/R/tm_g_association.R +++ b/R/tm_g_association.R @@ -28,21 +28,21 @@ #' data <- teal_data() #' data <- within(data, { #' library(nestcolor) -#' ADSL <- teal.modules.general::rADSL +#' ADSL <- rADSL #' }) #' datanames <- c("ADSL") #' datanames(data) <- datanames #' join_keys(data) <- default_cdisc_join_keys[datanames] #' -#' app <- teal::init( +#' app <- init( #' data = data, -#' modules = teal::modules( -#' teal.modules.general::tm_g_association( -#' ref = teal.transform::data_extract_spec( +#' modules = modules( +#' tm_g_association( +#' ref = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variable:", -#' choices = teal.transform::variable_choices( +#' choices = variable_choices( #' data[["ADSL"]], #' c("SEX", "RACE", "COUNTRY", "ARM", "STRATA1", "STRATA2", "ITTFL", "BMRKR2") #' ), @@ -50,11 +50,11 @@ #' fixed = FALSE #' ) #' ), -#' vars = teal.transform::data_extract_spec( +#' vars = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variables:", -#' choices = teal.transform::variable_choices( +#' choices = variable_choices( #' data[["ADSL"]], #' c("SEX", "RACE", "COUNTRY", "ARM", "STRATA1", "STRATA2", "ITTFL", "BMRKR2") #' ), diff --git a/R/tm_g_bivariate.R b/R/tm_g_bivariate.R index 2ec66c397..4f5588394 100644 --- a/R/tm_g_bivariate.R +++ b/R/tm_g_bivariate.R @@ -48,49 +48,49 @@ #' data <- teal_data() #' data <- within(data, { #' library(nestcolor) -#' ADSL <- teal.modules.general::rADSL +#' ADSL <- rADSL #' }) #' datanames <- c("ADSL") #' datanames(data) <- datanames #' join_keys(data) <- default_cdisc_join_keys[datanames] #' -#' app <- teal::init( +#' app <- init( #' data = data, -#' modules = teal::modules( -#' teal.modules.general::tm_g_bivariate( -#' x = teal.transform::data_extract_spec( +#' modules = modules( +#' tm_g_bivariate( +#' x = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variable:", -#' choices = teal.transform::variable_choices(data[["ADSL"]]), +#' choices = variable_choices(data[["ADSL"]]), #' selected = "AGE", #' fixed = FALSE #' ) #' ), -#' y = teal.transform::data_extract_spec( +#' y = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variable:", -#' choices = teal.transform::variable_choices(data[["ADSL"]]), +#' choices = variable_choices(data[["ADSL"]]), #' selected = "SEX", #' multiple = FALSE, #' fixed = FALSE #' ) #' ), -#' row_facet = teal.transform::data_extract_spec( +#' row_facet = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variable:", -#' choices = teal.transform::variable_choices(data[["ADSL"]]), +#' choices = variable_choices(data[["ADSL"]]), #' selected = "ARM", #' fixed = FALSE #' ) #' ), -#' col_facet = teal.transform::data_extract_spec( +#' col_facet = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variable:", -#' choices = teal.transform::variable_choices(data[["ADSL"]]), +#' choices = variable_choices(data[["ADSL"]]), #' selected = "COUNTRY", #' fixed = FALSE #' ) @@ -652,7 +652,6 @@ srv_g_bivariate <- function(id, #' @noRd #' #' @examples -#' #' bivariate_plot_call("ANL", "BAGE", "RACE", "numeric", "factor") #' bivariate_plot_call("ANL", "BAGE", character(0), "numeric", "NULL") bivariate_plot_call <- function(data_name, @@ -922,7 +921,6 @@ bivariate_ggplot_call <- function(x_class = c("NULL", "numeric", "integer", "fac #' @noRd #' #' @examples -#' #' facet_ggplot_call(LETTERS[1:3]) #' facet_ggplot_call(NULL, LETTERS[23:26]) #' facet_ggplot_call(LETTERS[1:3], LETTERS[23:26]) diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index 310b95cfd..c5fa28ab6 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -36,13 +36,13 @@ #' }) #' datanames(data) <- c("iris") #' -#' app <- teal::init( +#' app <- init( #' data = data, #' modules = list( -#' teal.modules.general::tm_g_distribution( -#' dist_var = teal.transform::data_extract_spec( +#' tm_g_distribution( +#' dist_var = data_extract_spec( #' dataname = "iris", -#' select = teal.transform::select_spec(variable_choices("iris"), "Petal.Length") +#' select = select_spec(variable_choices("iris"), "Petal.Length") #' ), #' ggplot2_args = teal.widgets::ggplot2_args( #' labs = list(subtitle = "Plot generated by Distribution Module") @@ -57,7 +57,7 @@ #' # Example with clinical data #' data <- teal_data() #' data <- within(data, { -#' ADSL <- teal.modules.general::rADSL +#' ADSL <- rADSL #' }) #' datanames <- c("ADSL") #' datanames(data) <- datanames @@ -68,29 +68,29 @@ #' selected = NULL #' ) #' -#' app <- teal::init( +#' app <- init( #' data = data, -#' modules = teal::modules( -#' teal.modules.general::tm_g_distribution( -#' dist_var = teal.transform::data_extract_spec( +#' modules = modules( +#' tm_g_distribution( +#' dist_var = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( -#' choices = teal.transform::variable_choices(data[["ADSL"]], c("AGE", "BMRKR1")), +#' select = select_spec( +#' choices = variable_choices(data[["ADSL"]], c("AGE", "BMRKR1")), #' selected = "BMRKR1", #' multiple = FALSE, #' fixed = FALSE #' ) #' ), -#' strata_var = teal.transform::data_extract_spec( +#' strata_var = data_extract_spec( #' dataname = "ADSL", -#' filter = teal.transform::filter_spec( +#' filter = filter_spec( #' vars = vars1, #' multiple = TRUE #' ) #' ), -#' group_var = teal.transform::data_extract_spec( +#' group_var = data_extract_spec( #' dataname = "ADSL", -#' filter = teal.transform::filter_spec( +#' filter = filter_spec( #' vars = vars1, #' multiple = TRUE #' ) diff --git a/R/tm_g_response.R b/R/tm_g_response.R index ce0c60a86..1314847f8 100644 --- a/R/tm_g_response.R +++ b/R/tm_g_response.R @@ -30,32 +30,32 @@ #' data <- teal_data() #' data <- within(data, { #' library(nestcolor) -#' ADSL <- teal.modules.general::rADSL +#' ADSL <- rADSL #' }) #' datanames <- c("ADSL") #' datanames(data) <- datanames #' join_keys(data) <- default_cdisc_join_keys[datanames] #' -#' app <- teal::init( +#' app <- init( #' data = data, -#' modules = teal::modules( -#' teal.modules.general::tm_g_response( +#' modules = modules( +#' tm_g_response( #' label = "Response Plots", -#' response = teal.transform::data_extract_spec( +#' response = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variable:", -#' choices = teal.transform::variable_choices(data[["ADSL"]], c("BMRKR2", "COUNTRY")), +#' choices = variable_choices(data[["ADSL"]], c("BMRKR2", "COUNTRY")), #' selected = "BMRKR2", #' multiple = FALSE, #' fixed = FALSE #' ) #' ), -#' x = teal.transform::data_extract_spec( +#' x = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variable:", -#' choices = teal.transform::variable_choices(data[["ADSL"]], c("SEX", "RACE")), +#' choices = variable_choices(data[["ADSL"]], c("SEX", "RACE")), #' selected = "RACE", #' multiple = FALSE, #' fixed = FALSE diff --git a/R/tm_g_scatterplot.R b/R/tm_g_scatterplot.R index cae83d74d..6605471f3 100644 --- a/R/tm_g_scatterplot.R +++ b/R/tm_g_scatterplot.R @@ -40,22 +40,22 @@ #' data <- teal_data() #' data <- within(data, { #' library(nestcolor) -#' ADSL <- teal.modules.general::rADSL +#' ADSL <- rADSL #' }) #' datanames <- c("ADSL") #' datanames(data) <- datanames #' join_keys(data) <- default_cdisc_join_keys[datanames] #' -#' app <- teal::init( +#' app <- init( #' data = data, -#' modules = teal::modules( -#' teal.modules.general::tm_g_scatterplot( +#' modules = modules( +#' tm_g_scatterplot( #' label = "Scatterplot Choices", -#' x = teal.transform::data_extract_spec( +#' x = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variable:", -#' choices = teal.transform::variable_choices( +#' choices = variable_choices( #' data[["ADSL"]], #' c("AGE", "BMRKR1", "BMRKR2") #' ), @@ -64,11 +64,11 @@ #' fixed = FALSE #' ) #' ), -#' y = teal.transform::data_extract_spec( +#' y = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variable:", -#' choices = teal.transform::variable_choices( +#' choices = variable_choices( #' data[["ADSL"]], #' c("AGE", "BMRKR1", "BMRKR2") #' ), @@ -77,11 +77,11 @@ #' fixed = FALSE #' ) #' ), -#' color_by = teal.transform::data_extract_spec( +#' color_by = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variable:", -#' choices = teal.transform::variable_choices( +#' choices = variable_choices( #' data[["ADSL"]], #' c("AGE", "BMRKR1", "BMRKR2", "RACE", "REGION1") #' ), @@ -90,11 +90,11 @@ #' fixed = FALSE #' ) #' ), -#' size_by = teal.transform::data_extract_spec( +#' size_by = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variable:", -#' choices = teal.transform::variable_choices( +#' choices = variable_choices( #' data[["ADSL"]], #' c("AGE", "BMRKR1", "BMRKR2", "RACE", "REGION1") #' ), @@ -103,11 +103,11 @@ #' fixed = FALSE #' ) #' ), -#' row_facet = teal.transform::data_extract_spec( +#' row_facet = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variable:", -#' choices = teal.transform::variable_choices( +#' choices = variable_choices( #' data[["ADSL"]], #' c("BMRKR2", "RACE", "REGION1") #' ), @@ -116,11 +116,11 @@ #' fixed = FALSE #' ) #' ), -#' col_facet = teal.transform::data_extract_spec( +#' col_facet = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variable:", -#' choices = teal.transform::variable_choices( +#' choices = variable_choices( #' data[["ADSL"]], #' c("BMRKR2", "RACE", "REGION1") #' ), diff --git a/R/tm_g_scatterplotmatrix.R b/R/tm_g_scatterplotmatrix.R index f7c26eddf..6bd7b26b2 100644 --- a/R/tm_g_scatterplotmatrix.R +++ b/R/tm_g_scatterplotmatrix.R @@ -22,20 +22,20 @@ #' #' data <- teal_data() #' data <- within(data, { -#' ADSL <- teal.modules.general::rADSL -#' ADRS <- teal.modules.general::rADRS +#' ADSL <- rADSL +#' ADRS <- rADRS #' }) #' datanames <- c("ADSL", "ADRS") #' datanames(data) <- datanames #' join_keys(data) <- default_cdisc_join_keys[datanames] #' -#' app <- teal::init( +#' app <- init( #' data = data, -#' modules = teal::modules( -#' teal.modules.general::tm_g_scatterplotmatrix( +#' modules = modules( +#' tm_g_scatterplotmatrix( #' label = "Scatterplot matrix", #' variables = list( -#' teal.transform::data_extract_spec( +#' data_extract_spec( #' dataname = "ADSL", #' select = select_spec( #' label = "Select variables:", @@ -46,9 +46,9 @@ #' fixed = FALSE #' ) #' ), -#' teal.transform::data_extract_spec( +#' data_extract_spec( #' dataname = "ADRS", -#' filter = teal.transform::filter_spec( +#' filter = filter_spec( #' label = "Select endpoints:", #' vars = c("PARAMCD", "AVISIT"), #' choices = value_choices(data[["ADRS"]], c("PARAMCD", "AVISIT"), c("PARAM", "AVISIT")), diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index c8b502da9..131374915 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -17,21 +17,20 @@ #' @export #' #' @examples -#' #' data <- teal_data() #' data <- within(data, { #' library(nestcolor) -#' ADSL <- teal.modules.general::rADSL -#' ADRS <- teal.modules.general::rADRS +#' ADSL <- rADSL +#' ADRS <- rADRS #' }) #' datanames <- c("ADSL", "ADRS") #' datanames(data) <- datanames #' join_keys(data) <- default_cdisc_join_keys[datanames] #' -#' app <- teal::init( +#' app <- init( #' data = data, -#' modules = teal::modules( -#' teal.modules.general::tm_missing_data( +#' modules = modules( +#' tm_missing_data( #' ggplot2_args = list( #' "Combinations Hist" = teal.widgets::ggplot2_args( #' labs = list(subtitle = "Plot produced by Missing Data Module", caption = NULL) diff --git a/R/tm_outliers.R b/R/tm_outliers.R index 42b5976ef..ad6d00195 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -16,10 +16,9 @@ #' @export #' #' @examples -#' #' data <- teal_data() #' data <- within(data, { -#' ADSL <- teal.modules.general::rADSL +#' ADSL <- rADSL #' }) #' datanames <- c("ADSL") #' datanames(data) <- datanames @@ -28,12 +27,12 @@ #' fact_vars_adsl <- names(Filter(isTRUE, sapply(data[["ADSL"]], is.factor))) #' vars <- choices_selected(variable_choices(data[["ADSL"]], fact_vars_adsl)) #' -#' app <- teal::init( +#' app <- init( #' data = data, -#' modules = teal::modules( -#' teal.modules.general::tm_outliers( +#' modules = modules( +#' tm_outliers( #' outlier_var = list( -#' teal.transform::data_extract_spec( +#' data_extract_spec( #' dataname = "ADSL", #' select = select_spec( #' label = "Select variable:", @@ -45,9 +44,9 @@ #' ) #' ), #' categorical_var = list( -#' teal.transform::data_extract_spec( +#' data_extract_spec( #' dataname = "ADSL", -#' filter = teal.transform::filter_spec( +#' filter = filter_spec( #' vars = vars, #' choices = value_choices(data[["ADSL"]], vars$selected), #' selected = value_choices(data[["ADSL"]], vars$selected), diff --git a/R/tm_t_crosstable.R b/R/tm_t_crosstable.R index 49ba6afd2..83b772b93 100644 --- a/R/tm_t_crosstable.R +++ b/R/tm_t_crosstable.R @@ -25,20 +25,20 @@ #' #' data <- teal_data() #' data <- within(data, { -#' ADSL <- teal.modules.general::rADSL +#' ADSL <- rADSL #' }) #' datanames <- c("ADSL") #' datanames(data) <- datanames #' join_keys(data) <- default_cdisc_join_keys[datanames] #' -#' app <- teal::init( +#' app <- init( #' data = data, -#' modules = teal::modules( -#' teal.modules.general::tm_t_crosstable( +#' modules = modules( +#' tm_t_crosstable( #' label = "Cross Table", -#' x = teal.transform::data_extract_spec( +#' x = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variable:", #' choices = variable_choices(data[["ADSL"]], subset = function(data) { #' idx <- !vapply(data, inherits, logical(1), c("Date", "POSIXct", "POSIXlt")) @@ -50,9 +50,9 @@ #' fixed = FALSE #' ) #' ), -#' y = teal.transform::data_extract_spec( +#' y = data_extract_spec( #' dataname = "ADSL", -#' select = teal.transform::select_spec( +#' select = select_spec( #' label = "Select variable:", #' choices = variable_choices(data[["ADSL"]], subset = function(data) { #' idx <- vapply(data, is.factor, logical(1)) diff --git a/R/tm_variable_browser.R b/R/tm_variable_browser.R index 901d3ca18..7297a924a 100644 --- a/R/tm_variable_browser.R +++ b/R/tm_variable_browser.R @@ -32,20 +32,19 @@ #' @export #' #' @examples -#' #' data <- teal_data() #' data <- within(data, { -#' ADSL <- teal.modules.general::rADSL -#' ADTTE <- teal.modules.general::rADTTE +#' ADSL <- rADSL +#' ADTTE <- rADTTE #' }) #' datanames <- c("ADSL", "ADTTE") #' datanames(data) <- datanames #' join_keys(data) <- default_cdisc_join_keys[datanames] #' -#' app <- teal::init( +#' app <- init( #' data = data, #' modules( -#' teal.modules.general::tm_variable_browser( +#' tm_variable_browser( #' label = "Variable browser", #' ggplot2_args = teal.widgets::ggplot2_args( #' labs = list(subtitle = "Plot generated by Variable Browser Module") diff --git a/R/utils.R b/R/utils.R index 07db56a98..237236604 100644 --- a/R/utils.R +++ b/R/utils.R @@ -132,12 +132,10 @@ add_facet_labels <- function(p, xfacet_label = NULL, yfacet_label = NULL) { #' @keywords internal #' #' @examples -#' \dontrun{ #' a <- 1 #' b <- 2 #' call_fun_dots("sum", c("a", "b")) #' eval(call_fun_dots("sum", c("a", "b"))) -#' } call_fun_dots <- function(fun, str_args) { do.call("call", c(list(fun), lapply(str_args, as.name)), quote = TRUE) } @@ -157,11 +155,8 @@ call_fun_dots <- function(fun, str_args) { #' @keywords internal #' #' @examples -#' \dontrun{ -#' ADSL <- teal.modules.general::rADSL -#' +#' ADSL <- ADSL #' varname_w_label("AGE", ADSL) -#' } varname_w_label <- function(var_names, dataset, wrap_width = 80, diff --git a/man/call_fun_dots.Rd b/man/call_fun_dots.Rd index 001a654b2..61542fac2 100644 --- a/man/call_fun_dots.Rd +++ b/man/call_fun_dots.Rd @@ -21,11 +21,9 @@ with arguments provided by \code{str_args}. Call a function with a character vector for the \code{...} argument } \examples{ -\dontrun{ a <- 1 b <- 2 call_fun_dots("sum", c("a", "b")) eval(call_fun_dots("sum", c("a", "b"))) } -} \keyword{internal} diff --git a/man/teal.modules.general-package.Rd b/man/teal.modules.general-package.Rd new file mode 100644 index 000000000..b792746dd --- /dev/null +++ b/man/teal.modules.general-package.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/teal.modules.general.R +\docType{package} +\name{teal.modules.general-package} +\alias{teal.modules.general} +\alias{teal.modules.general-package} +\title{teal.modules.general: General modules to add to a teal application} +\description{ +The modules in this package are generic modules that should work with any data set +(not necessarily for clinical trials data). +} +\author{ +\strong{Maintainer}: Dawid Kaledkowski \email{dawid.kaledkowski@roche.com} + +Authors: +\itemize{ + \item Pawel Rucki \email{pawel.rucki@roche.com} + \item Mahmoud Hallal \email{mahmoud.hallal@roche.com} + \item Maciej Nasinski + \item Konrad Pagacz + \item Nikolas Burkoff +} + +Other contributors: +\itemize{ + \item Ondrej Slama \email{ondrej.slama@roche.com} [contributor] + \item F. Hoffmann-La Roche AG [copyright holder, funder] +} + +} +\keyword{internal} diff --git a/man/teal.modules.general.Rd b/man/teal.modules.general.Rd deleted file mode 100644 index 14eb0e2fe..000000000 --- a/man/teal.modules.general.Rd +++ /dev/null @@ -1,11 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/teal.modules.general.R -\docType{package} -\name{teal.modules.general} -\alias{teal.modules.general} -\title{teal.modules.general: General modules to add to a teal application} -\description{ -The modules in this package are generic modules that should work with any data set -(not necessarily for clinical trials data). -} -\keyword{internal} diff --git a/man/tm_a_pca.Rd b/man/tm_a_pca.Rd index d0e4eb8ab..b8f1359ce 100644 --- a/man/tm_a_pca.Rd +++ b/man/tm_a_pca.Rd @@ -21,9 +21,6 @@ tm_a_pca( ) } \arguments{ -\item{label}{(\code{character(1)}) Label shown in the navigation item for the module. Any label possible except -\code{"global_filters"} - read more in \code{mapping} argument of \link[teal]{teal_slices}.} - \item{dat}{(\code{data_extract_spec} or \code{list} of multiple \code{data_extract_spec}) Columns used to compute PCA.} @@ -70,26 +67,26 @@ into context. For example the \code{\link[shiny:helpText]{shiny::helpText()}} el Principal component analysis module } \examples{ - # ADSL example data <- teal_data() data <- within(data, { library(nestcolor) - ADSL <- teal.modules.general::rADSL + ADSL <- rADSL }) datanames <- c("ADSL") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] -app <- teal::init( + +app <- init( data = data, - modules = teal::modules( - teal.modules.general::tm_a_pca( + modules = modules( + tm_a_pca( "PCA", - dat = teal.transform::data_extract_spec( + dat = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( - choices = teal.transform::variable_choices( + select = select_spec( + choices = variable_choices( data = data[["ADSL"]], c("BMRKR1", "AGE", "EOSDY") ), selected = c("BMRKR1", "AGE"), diff --git a/man/tm_a_regression.Rd b/man/tm_a_regression.Rd index 028978d7d..119e2c288 100644 --- a/man/tm_a_regression.Rd +++ b/man/tm_a_regression.Rd @@ -22,9 +22,6 @@ tm_a_regression( ) } \arguments{ -\item{label}{(\code{character(1)}) Label shown in the navigation item for the module. Any label possible except -\code{"global_filters"} - read more in \code{mapping} argument of \link[teal]{teal_slices}.} - \item{regressor}{(\code{data_extract_spec} or \code{list} of multiple \code{data_extract_spec}) Regressor variables from an incoming dataset with filtering and selecting.} @@ -90,20 +87,20 @@ For more examples, please see the vignette "Using regression plots" via data <- teal_data() data <- within(data, { library(nestcolor) - ADSL <- teal.modules.general::rADSL + ADSL <- rADSL }) datanames <- c("ADSL") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] -app <- teal::init( +app <- init( data = data, - modules = teal::modules( - teal.modules.general::tm_a_regression( + modules = modules( + tm_a_regression( label = "Regression", - response = teal.transform::data_extract_spec( + response = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variable:", choices = "BMRKR1", selected = "BMRKR1", @@ -111,11 +108,11 @@ app <- teal::init( fixed = TRUE ) ), - regressor = teal.transform::data_extract_spec( + regressor = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variables:", - choices = teal.transform::variable_choices(data[["ADSL"]], c("AGE", "SEX", "RACE")), + choices = variable_choices(data[["ADSL"]], c("AGE", "SEX", "RACE")), selected = "AGE", multiple = TRUE, fixed = FALSE diff --git a/man/tm_data_table.Rd b/man/tm_data_table.Rd index 3f64e26b6..143bf386d 100644 --- a/man/tm_data_table.Rd +++ b/man/tm_data_table.Rd @@ -17,9 +17,6 @@ tm_data_table( ) } \arguments{ -\item{label}{(\code{character(1)}) Label shown in the navigation item for the module. Any label possible except -\code{"global_filters"} - read more in \code{mapping} argument of \link[teal]{teal_slices}.} - \item{variables_selected}{(\code{list}) A named list of character vectors of the variables (i.e. columns) which should be initially shown for each dataset. Names of list elements should correspond to the names of the datasets available in the app. If no entry is specified for a dataset, the first six variables from that @@ -56,20 +53,19 @@ you require then set \code{options(DT.TOJSON_ARGS = list(na = "string"))} befor Note though that sorting of numeric columns with \code{NA}/\code{Inf} will be lexicographic not numerical. } \examples{ - data <- teal_data() data <- within(data, { library(nestcolor) - ADSL <- teal.modules.general::rADSL + ADSL <- rADSL }) datanames <- c("ADSL") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] -app <- teal::init( +app <- init( data = data, - modules = teal::modules( - teal.modules.general::tm_data_table( + modules = modules( + tm_data_table( variables_selected = list(ADSL = c("STUDYID", "USUBJID", "SUBJID", "SITEID", "AGE", "SEX")), dt_args = list(caption = "ADSL Table Caption") ) diff --git a/man/tm_file_viewer.Rd b/man/tm_file_viewer.Rd index db3cffb1f..b982a438a 100644 --- a/man/tm_file_viewer.Rd +++ b/man/tm_file_viewer.Rd @@ -10,9 +10,6 @@ tm_file_viewer( ) } \arguments{ -\item{label}{(\code{character(1)}) Label shown in the navigation item for the module. Any label possible except -\code{"global_filters"} - read more in \code{mapping} argument of \link[teal]{teal_slices}.} - \item{input_path}{optional, (\code{list}) of the input paths to either: specific files of accepted formats, a directory or a URL. The paths can be specified as absolute paths or relative to the running directory of the application. Will default to current working directory if not supplied.} @@ -29,10 +26,10 @@ data <- within(data, { }) datanames(data) <- c("data") -app <- teal::init( +app <- init( data = data, - modules = teal::modules( - teal.modules.general::tm_file_viewer( + modules = modules( + tm_file_viewer( input_path = list( folder = system.file("sample_files", package = "teal.modules.general"), png = system.file("sample_files/sample_file.png", package = "teal.modules.general"), diff --git a/man/tm_front_page.Rd b/man/tm_front_page.Rd index ceb61fb3f..eb70be881 100644 --- a/man/tm_front_page.Rd +++ b/man/tm_front_page.Rd @@ -14,9 +14,6 @@ tm_front_page( ) } \arguments{ -\item{label}{(\code{character(1)}) Label shown in the navigation item for the module. Any label possible except -\code{"global_filters"} - read more in \code{mapping} argument of \link[teal]{teal_slices}.} - \item{header_text}{\verb{character vector} text to be shown at the top of the module, for each element, if named the name is shown first in bold as a header followed by the value. The first element's header is displayed larger than the others} @@ -39,11 +36,10 @@ A \code{teal} module to be used in \code{teal} applications This \code{teal} module creates a simple front page for \code{teal} applications } \examples{ - data <- teal_data() data <- within(data, { library(nestcolor) - ADSL <- teal.modules.general::rADSL + ADSL <- rADSL attr(ADSL, "metadata") <- list("Author" = "NEST team", "data_source" = "synthetic data") }) datanames <- c("ADSL") @@ -60,10 +56,10 @@ table_input <- list( "Table 3" = table_3 ) -app <- teal::init( +app <- init( data = data, - modules = teal::modules( - teal.modules.general::tm_front_page( + modules = modules( + tm_front_page( header_text = c( "Important information" = "It can go here.", "Other information" = "Can go here." diff --git a/man/tm_g_association.Rd b/man/tm_g_association.Rd index 96a8f31a8..10111d491 100644 --- a/man/tm_g_association.Rd +++ b/man/tm_g_association.Rd @@ -21,9 +21,6 @@ tm_g_association( ) } \arguments{ -\item{label}{(\code{character(1)}) Label shown in the navigation item for the module. Any label possible except -\code{"global_filters"} - read more in \code{mapping} argument of \link[teal]{teal_slices}.} - \item{ref}{(\code{data_extract_spec} or \code{list} of multiple \code{data_extract_spec}) reference variable, must set \code{multiple = FALSE}.} @@ -74,21 +71,21 @@ For more examples, please see the vignette "Using association plot" via data <- teal_data() data <- within(data, { library(nestcolor) - ADSL <- teal.modules.general::rADSL + ADSL <- rADSL }) datanames <- c("ADSL") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] -app <- teal::init( +app <- init( data = data, - modules = teal::modules( - teal.modules.general::tm_g_association( - ref = teal.transform::data_extract_spec( + modules = modules( + tm_g_association( + ref = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variable:", - choices = teal.transform::variable_choices( + choices = variable_choices( data[["ADSL"]], c("SEX", "RACE", "COUNTRY", "ARM", "STRATA1", "STRATA2", "ITTFL", "BMRKR2") ), @@ -96,11 +93,11 @@ app <- teal::init( fixed = FALSE ) ), - vars = teal.transform::data_extract_spec( + vars = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variables:", - choices = teal.transform::variable_choices( + choices = variable_choices( data[["ADSL"]], c("SEX", "RACE", "COUNTRY", "ARM", "STRATA1", "STRATA2", "ITTFL", "BMRKR2") ), diff --git a/man/tm_g_bivariate.Rd b/man/tm_g_bivariate.Rd index cdcd38fb3..68286daa2 100644 --- a/man/tm_g_bivariate.Rd +++ b/man/tm_g_bivariate.Rd @@ -30,9 +30,6 @@ tm_g_bivariate( ) } \arguments{ -\item{label}{(\code{character(1)}) Label shown in the navigation item for the module. Any label possible except -\code{"global_filters"} - read more in \code{mapping} argument of \link[teal]{teal_slices}.} - \item{x}{(\code{data_extract_spec} or \code{list} of multiple \code{data_extract_spec}) Variable names selected to plot along the x-axis by default. Variable can be numeric, factor or character. No empty selections are allowed!} @@ -116,49 +113,49 @@ For more examples, please see the vignette "Using bivariate plot" via data <- teal_data() data <- within(data, { library(nestcolor) - ADSL <- teal.modules.general::rADSL + ADSL <- rADSL }) datanames <- c("ADSL") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] -app <- teal::init( +app <- init( data = data, - modules = teal::modules( - teal.modules.general::tm_g_bivariate( - x = teal.transform::data_extract_spec( + modules = modules( + tm_g_bivariate( + x = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variable:", - choices = teal.transform::variable_choices(data[["ADSL"]]), + choices = variable_choices(data[["ADSL"]]), selected = "AGE", fixed = FALSE ) ), - y = teal.transform::data_extract_spec( + y = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variable:", - choices = teal.transform::variable_choices(data[["ADSL"]]), + choices = variable_choices(data[["ADSL"]]), selected = "SEX", multiple = FALSE, fixed = FALSE ) ), - row_facet = teal.transform::data_extract_spec( + row_facet = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variable:", - choices = teal.transform::variable_choices(data[["ADSL"]]), + choices = variable_choices(data[["ADSL"]]), selected = "ARM", fixed = FALSE ) ), - col_facet = teal.transform::data_extract_spec( + col_facet = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variable:", - choices = teal.transform::variable_choices(data[["ADSL"]]), + choices = variable_choices(data[["ADSL"]]), selected = "COUNTRY", fixed = FALSE ) diff --git a/man/tm_g_distribution.Rd b/man/tm_g_distribution.Rd index edd47d618..85ac70573 100644 --- a/man/tm_g_distribution.Rd +++ b/man/tm_g_distribution.Rd @@ -21,9 +21,6 @@ tm_g_distribution( ) } \arguments{ -\item{label}{(\code{character(1)}) Label shown in the navigation item for the module. Any label possible except -\code{"global_filters"} - read more in \code{mapping} argument of \link[teal]{teal_slices}.} - \item{dist_var}{(\code{data_extract_spec} or \code{list} of multiple \code{data_extract_spec}) Variable to consider for the distribution analysis.} @@ -80,13 +77,13 @@ data <- within(data, { }) datanames(data) <- c("iris") -app <- teal::init( +app <- init( data = data, modules = list( - teal.modules.general::tm_g_distribution( - dist_var = teal.transform::data_extract_spec( + tm_g_distribution( + dist_var = data_extract_spec( dataname = "iris", - select = teal.transform::select_spec(variable_choices("iris"), "Petal.Length") + select = select_spec(variable_choices("iris"), "Petal.Length") ), ggplot2_args = teal.widgets::ggplot2_args( labs = list(subtitle = "Plot generated by Distribution Module") @@ -101,7 +98,7 @@ if (interactive()) { # Example with clinical data data <- teal_data() data <- within(data, { - ADSL <- teal.modules.general::rADSL + ADSL <- rADSL }) datanames <- c("ADSL") datanames(data) <- datanames @@ -112,29 +109,29 @@ vars1 <- choices_selected( selected = NULL ) -app <- teal::init( +app <- init( data = data, - modules = teal::modules( - teal.modules.general::tm_g_distribution( - dist_var = teal.transform::data_extract_spec( + modules = modules( + tm_g_distribution( + dist_var = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( - choices = teal.transform::variable_choices(data[["ADSL"]], c("AGE", "BMRKR1")), + select = select_spec( + choices = variable_choices(data[["ADSL"]], c("AGE", "BMRKR1")), selected = "BMRKR1", multiple = FALSE, fixed = FALSE ) ), - strata_var = teal.transform::data_extract_spec( + strata_var = data_extract_spec( dataname = "ADSL", - filter = teal.transform::filter_spec( + filter = filter_spec( vars = vars1, multiple = TRUE ) ), - group_var = teal.transform::data_extract_spec( + group_var = data_extract_spec( dataname = "ADSL", - filter = teal.transform::filter_spec( + filter = filter_spec( vars = vars1, multiple = TRUE ) diff --git a/man/tm_g_response.Rd b/man/tm_g_response.Rd index ae16fde07..67a1c3ca3 100644 --- a/man/tm_g_response.Rd +++ b/man/tm_g_response.Rd @@ -24,9 +24,6 @@ tm_g_response( ) } \arguments{ -\item{label}{(\code{character(1)}) Label shown in the navigation item for the module. Any label possible except -\code{"global_filters"} - read more in \code{mapping} argument of \link[teal]{teal_slices}.} - \item{response}{(\code{data_extract_spec} or \code{list} of multiple \code{data_extract_spec}) Which variable to use as the response. You can define one fixed column by using the setting \code{fixed = TRUE} inside the \code{select_spec}. @@ -89,32 +86,32 @@ For more examples, please see the vignette "Using response plot" via data <- teal_data() data <- within(data, { library(nestcolor) - ADSL <- teal.modules.general::rADSL + ADSL <- rADSL }) datanames <- c("ADSL") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] -app <- teal::init( +app <- init( data = data, - modules = teal::modules( - teal.modules.general::tm_g_response( + modules = modules( + tm_g_response( label = "Response Plots", - response = teal.transform::data_extract_spec( + response = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variable:", - choices = teal.transform::variable_choices(data[["ADSL"]], c("BMRKR2", "COUNTRY")), + choices = variable_choices(data[["ADSL"]], c("BMRKR2", "COUNTRY")), selected = "BMRKR2", multiple = FALSE, fixed = FALSE ) ), - x = teal.transform::data_extract_spec( + x = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variable:", - choices = teal.transform::variable_choices(data[["ADSL"]], c("SEX", "RACE")), + choices = variable_choices(data[["ADSL"]], c("SEX", "RACE")), selected = "RACE", multiple = FALSE, fixed = FALSE diff --git a/man/tm_g_scatterplot.Rd b/man/tm_g_scatterplot.Rd index 46a0f8170..354b34fdb 100644 --- a/man/tm_g_scatterplot.Rd +++ b/man/tm_g_scatterplot.Rd @@ -28,9 +28,6 @@ tm_g_scatterplot( ) } \arguments{ -\item{label}{(\code{character(1)}) Label shown in the navigation item for the module. Any label possible except -\code{"global_filters"} - read more in \code{mapping} argument of \link[teal]{teal_slices}.} - \item{x}{(\code{data_extract_spec} or \code{list} of multiple \code{data_extract_spec}) Variable names selected to plot along the x-axis by default.} @@ -103,22 +100,22 @@ For more examples, please see the vignette "Using scatterplot" via data <- teal_data() data <- within(data, { library(nestcolor) - ADSL <- teal.modules.general::rADSL + ADSL <- rADSL }) datanames <- c("ADSL") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] -app <- teal::init( +app <- init( data = data, - modules = teal::modules( - teal.modules.general::tm_g_scatterplot( + modules = modules( + tm_g_scatterplot( label = "Scatterplot Choices", - x = teal.transform::data_extract_spec( + x = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variable:", - choices = teal.transform::variable_choices( + choices = variable_choices( data[["ADSL"]], c("AGE", "BMRKR1", "BMRKR2") ), @@ -127,11 +124,11 @@ app <- teal::init( fixed = FALSE ) ), - y = teal.transform::data_extract_spec( + y = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variable:", - choices = teal.transform::variable_choices( + choices = variable_choices( data[["ADSL"]], c("AGE", "BMRKR1", "BMRKR2") ), @@ -140,11 +137,11 @@ app <- teal::init( fixed = FALSE ) ), - color_by = teal.transform::data_extract_spec( + color_by = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variable:", - choices = teal.transform::variable_choices( + choices = variable_choices( data[["ADSL"]], c("AGE", "BMRKR1", "BMRKR2", "RACE", "REGION1") ), @@ -153,11 +150,11 @@ app <- teal::init( fixed = FALSE ) ), - size_by = teal.transform::data_extract_spec( + size_by = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variable:", - choices = teal.transform::variable_choices( + choices = variable_choices( data[["ADSL"]], c("AGE", "BMRKR1", "BMRKR2", "RACE", "REGION1") ), @@ -166,11 +163,11 @@ app <- teal::init( fixed = FALSE ) ), - row_facet = teal.transform::data_extract_spec( + row_facet = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variable:", - choices = teal.transform::variable_choices( + choices = variable_choices( data[["ADSL"]], c("BMRKR2", "RACE", "REGION1") ), @@ -179,11 +176,11 @@ app <- teal::init( fixed = FALSE ) ), - col_facet = teal.transform::data_extract_spec( + col_facet = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variable:", - choices = teal.transform::variable_choices( + choices = variable_choices( data[["ADSL"]], c("BMRKR2", "RACE", "REGION1") ), diff --git a/man/tm_g_scatterplotmatrix.Rd b/man/tm_g_scatterplotmatrix.Rd index a43190fa5..87da075c7 100644 --- a/man/tm_g_scatterplotmatrix.Rd +++ b/man/tm_g_scatterplotmatrix.Rd @@ -14,9 +14,6 @@ tm_g_scatterplotmatrix( ) } \arguments{ -\item{label}{(\code{character(1)}) Label shown in the navigation item for the module. Any label possible except -\code{"global_filters"} - read more in \code{mapping} argument of \link[teal]{teal_slices}.} - \item{variables}{(\code{data_extract_spec} or \code{list} of multiple \code{data_extract_spec}) Plotting variables from an incoming dataset with filtering and selecting. In case of \code{data_extract_spec} use \code{select_spec(..., ordered = TRUE)} if plot elements should be @@ -47,20 +44,20 @@ For more examples, please see the vignette "Using scatterplot matrix" via data <- teal_data() data <- within(data, { - ADSL <- teal.modules.general::rADSL - ADRS <- teal.modules.general::rADRS + ADSL <- rADSL + ADRS <- rADRS }) datanames <- c("ADSL", "ADRS") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] -app <- teal::init( +app <- init( data = data, - modules = teal::modules( - teal.modules.general::tm_g_scatterplotmatrix( + modules = modules( + tm_g_scatterplotmatrix( label = "Scatterplot matrix", variables = list( - teal.transform::data_extract_spec( + data_extract_spec( dataname = "ADSL", select = select_spec( label = "Select variables:", @@ -71,9 +68,9 @@ app <- teal::init( fixed = FALSE ) ), - teal.transform::data_extract_spec( + data_extract_spec( dataname = "ADRS", - filter = teal.transform::filter_spec( + filter = filter_spec( label = "Select endpoints:", vars = c("PARAMCD", "AVISIT"), choices = value_choices(data[["ADRS"]], c("PARAMCD", "AVISIT"), c("PARAM", "AVISIT")), diff --git a/man/tm_missing_data.Rd b/man/tm_missing_data.Rd index f39d398d2..ee5c013b6 100644 --- a/man/tm_missing_data.Rd +++ b/man/tm_missing_data.Rd @@ -19,9 +19,6 @@ tm_missing_data( ) } \arguments{ -\item{label}{(\code{character(1)}) Label shown in the navigation item for the module. Any label possible except -\code{"global_filters"} - read more in \code{mapping} argument of \link[teal]{teal_slices}.} - \item{plot_height}{optional, (\code{numeric}) A vector of length three with \verb{c(value, min and max)} for a slider encoding the plot height.} @@ -54,21 +51,20 @@ Present analysis of missing observations and patients. specifically designed for use with \code{data.frames}. } \examples{ - data <- teal_data() data <- within(data, { library(nestcolor) - ADSL <- teal.modules.general::rADSL - ADRS <- teal.modules.general::rADRS + ADSL <- rADSL + ADRS <- rADRS }) datanames <- c("ADSL", "ADRS") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] -app <- teal::init( +app <- init( data = data, - modules = teal::modules( - teal.modules.general::tm_missing_data( + modules = modules( + tm_missing_data( ggplot2_args = list( "Combinations Hist" = teal.widgets::ggplot2_args( labs = list(subtitle = "Plot produced by Missing Data Module", caption = NULL) diff --git a/man/tm_outliers.Rd b/man/tm_outliers.Rd index a3d013200..3986615e7 100644 --- a/man/tm_outliers.Rd +++ b/man/tm_outliers.Rd @@ -18,9 +18,6 @@ tm_outliers( ) } \arguments{ -\item{label}{(\code{character(1)}) Label shown in the navigation item for the module. Any label possible except -\code{"global_filters"} - read more in \code{mapping} argument of \link[teal]{teal_slices}.} - \item{outlier_var}{(\code{data_extract_spec} or \code{list} of multiple \code{data_extract_spec}) variable to consider for the outliers analysis.} @@ -55,10 +52,9 @@ into context. For example the \code{\link[shiny:helpText]{shiny::helpText()}} el Module to analyze and identify outliers using different methods } \examples{ - data <- teal_data() data <- within(data, { - ADSL <- teal.modules.general::rADSL + ADSL <- rADSL }) datanames <- c("ADSL") datanames(data) <- datanames @@ -67,12 +63,12 @@ join_keys(data) <- default_cdisc_join_keys[datanames] fact_vars_adsl <- names(Filter(isTRUE, sapply(data[["ADSL"]], is.factor))) vars <- choices_selected(variable_choices(data[["ADSL"]], fact_vars_adsl)) -app <- teal::init( +app <- init( data = data, - modules = teal::modules( - teal.modules.general::tm_outliers( + modules = modules( + tm_outliers( outlier_var = list( - teal.transform::data_extract_spec( + data_extract_spec( dataname = "ADSL", select = select_spec( label = "Select variable:", @@ -84,9 +80,9 @@ app <- teal::init( ) ), categorical_var = list( - teal.transform::data_extract_spec( + data_extract_spec( dataname = "ADSL", - filter = teal.transform::filter_spec( + filter = filter_spec( vars = vars, choices = value_choices(data[["ADSL"]], vars$selected), selected = value_choices(data[["ADSL"]], vars$selected), diff --git a/man/tm_t_crosstable.Rd b/man/tm_t_crosstable.Rd index 668380fa5..eba7f7f72 100644 --- a/man/tm_t_crosstable.Rd +++ b/man/tm_t_crosstable.Rd @@ -16,9 +16,6 @@ tm_t_crosstable( ) } \arguments{ -\item{label}{(\code{character(1)}) Label shown in the navigation item for the module. Any label possible except -\code{"global_filters"} - read more in \code{mapping} argument of \link[teal]{teal_slices}.} - \item{x}{(\code{data_extract_spec} or \code{list} of multiple \code{data_extract_spec}) Object with all available choices with pre-selected option for variable X - row values. In case of \code{data_extract_spec} use \code{select_spec(..., ordered = TRUE)} if table elements should be @@ -57,20 +54,20 @@ For more examples, please see the vignette "Using cross table" via data <- teal_data() data <- within(data, { - ADSL <- teal.modules.general::rADSL + ADSL <- rADSL }) datanames <- c("ADSL") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] -app <- teal::init( +app <- init( data = data, - modules = teal::modules( - teal.modules.general::tm_t_crosstable( + modules = modules( + tm_t_crosstable( label = "Cross Table", - x = teal.transform::data_extract_spec( + x = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variable:", choices = variable_choices(data[["ADSL"]], subset = function(data) { idx <- !vapply(data, inherits, logical(1), c("Date", "POSIXct", "POSIXlt")) @@ -82,9 +79,9 @@ app <- teal::init( fixed = FALSE ) ), - y = teal.transform::data_extract_spec( + y = data_extract_spec( dataname = "ADSL", - select = teal.transform::select_spec( + select = select_spec( label = "Select variable:", choices = variable_choices(data[["ADSL"]], subset = function(data) { idx <- vapply(data, is.factor, logical(1)) diff --git a/man/tm_variable_browser.Rd b/man/tm_variable_browser.Rd index 3c79fe6fd..189b708ea 100644 --- a/man/tm_variable_browser.Rd +++ b/man/tm_variable_browser.Rd @@ -20,9 +20,6 @@ tm_variable_browser( ) } \arguments{ -\item{label}{(\code{character(1)}) Label shown in the navigation item for the module. Any label possible except -\code{"global_filters"} - read more in \code{mapping} argument of \link[teal]{teal_slices}.} - \item{datasets_selected}{(\code{character}) A vector of datasets which should be shown and in what order. Names in the vector have to correspond with datasets names. If vector of length zero (default) then all datasets are shown. @@ -57,20 +54,19 @@ or numbers with a checkbox allowing users to switch how they are treated (if < 6 then the default is categorical, otherwise it is numeric). } \examples{ - data <- teal_data() data <- within(data, { - ADSL <- teal.modules.general::rADSL - ADTTE <- teal.modules.general::rADTTE + ADSL <- rADSL + ADTTE <- rADTTE }) datanames <- c("ADSL", "ADTTE") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] -app <- teal::init( +app <- init( data = data, modules( - teal.modules.general::tm_variable_browser( + tm_variable_browser( label = "Variable browser", ggplot2_args = teal.widgets::ggplot2_args( labs = list(subtitle = "Plot generated by Variable Browser Module") diff --git a/man/varname_w_label.Rd b/man/varname_w_label.Rd index 6e241bf42..9355c4f2c 100644 --- a/man/varname_w_label.Rd +++ b/man/varname_w_label.Rd @@ -33,10 +33,7 @@ name with label.} Get variable name with label } \examples{ -\dontrun{ -ADSL <- teal.modules.general::rADSL - +ADSL <- ADSL varname_w_label("AGE", ADSL) } -} \keyword{internal} diff --git a/tests/testthat/setup-logger.R b/tests/testthat/setup-logger.R new file mode 100644 index 000000000..f6401f548 --- /dev/null +++ b/tests/testthat/setup-logger.R @@ -0,0 +1 @@ +logger::log_appender(function(...) NULL, namespace = "teal.modules.general") diff --git a/tests/testthat/setup-options.R b/tests/testthat/setup-options.R new file mode 100644 index 000000000..bea4d39e8 --- /dev/null +++ b/tests/testthat/setup-options.R @@ -0,0 +1,17 @@ +opts_partial_match_old <- list( + warnPartialMatchDollar = getOption("warnPartialMatchDollar"), + warnPartialMatchArgs = getOption("warnPartialMatchArgs"), + warnPartialMatchAttr = getOption("warnPartialMatchAttr") +) +opts_partial_match_new <- list( + warnPartialMatchDollar = TRUE, + warnPartialMatchArgs = TRUE, + warnPartialMatchAttr = TRUE +) + +if (isFALSE(getFromNamespace("on_cran", "testthat")()) && require("withr")) { + withr::local_options( + opts_partial_match_new, + .local_envir = testthat::teardown_env() + ) +} diff --git a/vignettes/teal-modules-general.Rmd b/vignettes/teal-modules-general.Rmd index 588639320..5d2305689 100644 --- a/vignettes/teal-modules-general.Rmd +++ b/vignettes/teal-modules-general.Rmd @@ -20,7 +20,7 @@ clinical data. The modules of `teal.modules.general` can be combined with module 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/articles/teal.html) of the `teal` package. See also `teal.modules.clinical's` [`README`](https://insightsengineering.github.io/teal.modules.clinical/index.html). @@ -43,20 +43,18 @@ A simple application including a `tm_variable_browser` module could look like th ```{r, message = FALSE, results = "hide"} library(teal.modules.general) -# nolint start data <- teal_data() data <- within(data, { - ADSL <- teal.modules.general::rADSL - ADTTE <- teal.modules.general::rADTTE + ADSL <- rADSL + ADTTE <- rADTTE }) datanames <- c("ADSL", "ADTTE") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] -# nolint end -app <- teal::init( +app <- init( data = data, - modules = teal::modules( + modules = modules( tm_variable_browser( label = "Variable browser", ggplot2_args = teal.widgets::ggplot2_args( @@ -85,16 +83,14 @@ so both the code and data are stored together. Following this, we set the `datanames` and `join_keys`. ```r -# nolint start data <- teal_data() data <- within(data, { - ADSL <- teal.modules.general::rADSL - ADTTE <- teal.modules.general::rADTTE + ADSL <- rADSL + ADTTE <- rADTTE }) datanames <- c("ADSL", "ADTTE") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] -# nolint end ``` There is no need to load `teal` as `teal.modules.general` already depends on it. @@ -104,9 +100,9 @@ argument tells `teal` about the input data - the two datasets `ADSL` and `ADTTE` argument indicates the modules included in the application. Here, we include only one - `tm_variable_browser`. ```{r, results = "hide"} -app <- teal::init( +app <- init( data = data, - modules = teal::modules( + modules = modules( tm_variable_browser( # module name to display in the GUI label = "Variable browser", @@ -123,7 +119,7 @@ app <- teal::init( The `shiny` function `shinyApp` used the `ui` and `server` objects to initialize the `teal` app. ```{r, eval = FALSE} -shiny::shinyApp(app$ui, app$server) +shinyApp(app$ui, app$server) ``` In a `teal` app, data and modules are decoupled. In the app above: diff --git a/vignettes/using-association-plot.Rmd b/vignettes/using-association-plot.Rmd index 8921c79d1..76251bc40 100644 --- a/vignettes/using-association-plot.Rmd +++ b/vignettes/using-association-plot.Rmd @@ -38,38 +38,35 @@ Inside this app 5 datasets will be used 5. `ADLB` A long data set with lab measurements for each subject ```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} -# nolint start -ADSL <- teal.modules.general::rADSL -ADSL2 <- teal.modules.general::rADSL %>% +ADSL <- rADSL +ADSL2 <- rADSL %>% mutate(TRTDUR = round(as.numeric(TRTEDTM - TRTSDTM), 1)) -ADRS <- teal.modules.general::rADRS -ADTTE <- teal.modules.general::rADTTE -ADLB <- teal.modules.general::rADLB %>% +ADRS <- rADRS +ADTTE <- rADTTE +ADLB <- rADLB %>% mutate(CHGC = as.factor(case_when( CHG < 1 ~ "N", CHG > 1 ~ "P", TRUE ~ "-" ))) -# nolint end ``` ## Create an `app` variable -This is the most important section. We will use the [`teal::init`](https://insightsengineering.github.io/teal/reference/init) function to +This is the most important section. We will use the [`init`](https://insightsengineering.github.io/teal/reference/init) function to create an app. The data will be handed over using [`teal.data::cdisc_data`](https://insightsengineering.github.io/teal.data/reference/cdisc_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"} -# nolint start data <- teal_data() data <- within(data, { - ADSL <- teal.modules.general::rADSL + ADSL <- rADSL ADSL2 <- ADSL %>% mutate(TRTDUR = round(as.numeric(TRTEDTM - TRTSDTM), 1)) - ADRS <- teal.modules.general::rADRS - ADTTE <- teal.modules.general::rADTTE - ADLB <- teal.modules.general::rADLB %>% + ADRS <- rADRS + ADTTE <- rADTTE + ADLB <- rADLB %>% mutate(CHGC = as.factor(case_when( CHG < 1 ~ "N", CHG > 1 ~ "P", @@ -84,11 +81,9 @@ names(jk_adsl2)[names(jk_adsl2) == "ADSL"] <- "ADSL2" jk <- c(jk, jk_adsl2) jk["ADSL2", "ADSL"] <- c("USUBJID", "STUDYID") -# nolint end - -app <- teal::init( +app <- init( data = data, - modules = teal::modules( + modules = modules( # tm_g_association ---- modules( label = "Association plot", @@ -304,8 +299,8 @@ app <- teal::init( ## 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} shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024)) diff --git a/vignettes/using-bivariate-plot.Rmd b/vignettes/using-bivariate-plot.Rmd index ed09e6c78..4810f0cd5 100644 --- a/vignettes/using-bivariate-plot.Rmd +++ b/vignettes/using-bivariate-plot.Rmd @@ -41,15 +41,14 @@ Inside this app 5 datasets will be used 5. `ADLB` A long data set with lab measurements for each subject ```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} -# nolint start data <- teal_data() data <- within(data, { - ADSL <- teal.modules.general::rADSL - ADSL2 <- teal.modules.general::rADSL %>% + ADSL <- rADSL + ADSL2 <- rADSL %>% mutate(TRTDUR = round(as.numeric(TRTEDTM - TRTSDTM), 1)) - ADRS <- teal.modules.general::rADRS - ADTTE <- teal.modules.general::rADTTE - ADLB <- teal.modules.general::rADLB %>% + ADRS <- rADRS + ADTTE <- rADTTE + ADLB <- rADLB %>% mutate(CHGC = as.factor(case_when( CHG < 1 ~ "N", CHG > 1 ~ "P", @@ -63,7 +62,6 @@ jk_adsl2 <- jk names(jk_adsl2)[names(jk_adsl2) == "ADSL"] <- "ADSL2" jk <- c(jk, jk_adsl2) jk["ADSL2", "ADSL"] <- c("USUBJID", "STUDYID") -# nolint end ``` ## Create an `app` variable @@ -74,9 +72,9 @@ 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"} -app <- teal::init( +app <- init( data = data, - modules = teal::modules( + modules = modules( # tm_g_bivariate ------ modules( label = "Bivariate plot", diff --git a/vignettes/using-cross-table.Rmd b/vignettes/using-cross-table.Rmd index 2ab93bd9a..d82300ef7 100644 --- a/vignettes/using-cross-table.Rmd +++ b/vignettes/using-cross-table.Rmd @@ -35,11 +35,10 @@ Inside this app 2 datasets will be used 2. `ADLB` A long data set with lab measurements for each subject ```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide", echo=2:6} -# nolint start data <- teal_data() data <- within(data, { - ADSL <- teal.modules.general::rADSL - ADLB <- teal.modules.general::rADLB %>% + ADSL <- rADSL + ADLB <- rADLB %>% mutate(CHGC = as.factor(case_when( CHG < 1 ~ "N", CHG > 1 ~ "P", @@ -49,7 +48,6 @@ data <- within(data, { datanames <- c("ADSL", "ADLB") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] -# nolint end ``` ## Create an `app` variable @@ -60,9 +58,9 @@ itself will be constructed by multiple calls of `tm_t_crosstable` using differen combinations of data sets. ```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} -app <- teal::init( +app <- init( data = data, - modules = teal::modules( + modules = modules( modules( label = "Cross table", tm_t_crosstable( diff --git a/vignettes/using-data-table.Rmd b/vignettes/using-data-table.Rmd index 77b8d4eb7..aff42a157 100644 --- a/vignettes/using-data-table.Rmd +++ b/vignettes/using-data-table.Rmd @@ -35,17 +35,15 @@ Inside this app 3 datasets will be used 3. `ADLB` A long data set with lab measurements for each subject ```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} -# nolint start data <- teal_data() data <- within(data, { - ADSL <- teal.modules.general::rADSL - ADTTE <- teal.modules.general::rADTTE - ADLB <- teal.modules.general::rADLB + ADSL <- rADSL + ADTTE <- rADTTE + ADLB <- rADLB }) datanames <- c("ADSL", "ADTTE", "ADLB") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] -# nolint end ``` ## Create an `app` variable @@ -55,9 +53,9 @@ create an app. The data will be handed over using [`teal.data::cdisc_data`](http combinations of data sets. ```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} -app <- teal::init( +app <- init( data = data, - modules = teal::modules( + modules = modules( # two-datasets example tm_data_table( label = "Two datasets", @@ -102,8 +100,8 @@ app <- teal::init( ## 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} shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024)) diff --git a/vignettes/using-outliers-module.Rmd b/vignettes/using-outliers-module.Rmd index be6c2325f..243964e1b 100644 --- a/vignettes/using-outliers-module.Rmd +++ b/vignettes/using-outliers-module.Rmd @@ -36,17 +36,15 @@ Inside this app 5 datasets will be used 3. `ADLB` A long data set with lab measurements for each subject ```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} -# nolint start data <- teal_data() data <- within(data, { - ADSL <- teal.modules.general::rADSL - ADRS <- teal.modules.general::rADRS - ADLB <- teal.modules.general::rADLB + ADSL <- rADSL + ADRS <- rADRS + ADLB <- rADLB }) datanames <- c("ADSL", "ADRS", "ADLB") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] -# nolint end ``` ## Create an `app` variable @@ -57,9 +55,9 @@ 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"} -app <- teal::init( +app <- init( data = data, - modules = teal::modules( + modules = modules( # tm_outliers ---- modules( label = "Outliers module", @@ -181,8 +179,8 @@ app <- teal::init( ``` ## 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} shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024)) diff --git a/vignettes/using-regression-plots.Rmd b/vignettes/using-regression-plots.Rmd index c409775a3..386c56b08 100644 --- a/vignettes/using-regression-plots.Rmd +++ b/vignettes/using-regression-plots.Rmd @@ -39,15 +39,14 @@ Inside this app 5 datasets will be used 5. `ADLB` A long data set with lab measurements for each subject ```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} -# nolint start data <- teal_data() data <- within(data, { - ADSL <- teal.modules.general::rADSL - ADSL2 <- teal.modules.general::rADSL %>% + ADSL <- rADSL + ADSL2 <- rADSL %>% mutate(TRTDUR = round(as.numeric(TRTEDTM - TRTSDTM), 1)) - ADRS <- teal.modules.general::rADRS - ADTTE <- teal.modules.general::rADTTE - ADLB <- teal.modules.general::rADLB %>% + ADRS <- rADRS + ADTTE <- rADTTE + ADLB <- rADLB %>% mutate(CHGC = as.factor(case_when( CHG < 1 ~ "N", CHG > 1 ~ "P", @@ -61,7 +60,6 @@ jk_adsl2 <- jk names(jk_adsl2)[names(jk_adsl2) == "ADSL"] <- "ADSL2" jk <- c(jk, jk_adsl2) jk["ADSL2", "ADSL"] <- c("USUBJID", "STUDYID") -# nolint end ``` ## Create an `app` variable @@ -72,9 +70,9 @@ itself will be constructed by multiple calls of `tm_a_regression` using differen combinations of data sets. ```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} -app <- teal::init( +app <- init( data = data, - modules = teal::modules( + modules = modules( modules( label = "Regression plots", tm_a_regression( diff --git a/vignettes/using-response-plot.Rmd b/vignettes/using-response-plot.Rmd index b60f74387..845d7bf3a 100644 --- a/vignettes/using-response-plot.Rmd +++ b/vignettes/using-response-plot.Rmd @@ -38,15 +38,14 @@ Inside this app 5 datasets will be used 5. `ADLB` A long data set with lab measurements for each subject ```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} -# nolint start data <- teal_data() data <- within(data, { - ADSL <- teal.modules.general::rADSL - ADSL2 <- teal.modules.general::rADSL %>% + ADSL <- rADSL + ADSL2 <- rADSL %>% mutate(TRTDUR = round(as.numeric(TRTEDTM - TRTSDTM), 1)) - ADRS <- teal.modules.general::rADRS - ADTTE <- teal.modules.general::rADTTE - ADLB <- teal.modules.general::rADLB %>% + ADRS <- rADRS + ADTTE <- rADTTE + ADLB <- rADLB %>% mutate(CHGC = as.factor(case_when( CHG < 1 ~ "N", CHG > 1 ~ "P", @@ -60,7 +59,6 @@ jk_adsl2 <- jk names(jk_adsl2)[names(jk_adsl2) == "ADSL"] <- "ADSL2" jk <- c(jk, jk_adsl2) jk["ADSL2", "ADSL"] <- c("USUBJID", "STUDYID") -# nolint end ``` ## Create an `app` variable @@ -71,9 +69,9 @@ 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"} -app <- teal::init( +app <- init( data = data, - modules = teal::modules( + modules = modules( modules( label = "Response plot", tm_g_response( diff --git a/vignettes/using-scatterplot-matrix.Rmd b/vignettes/using-scatterplot-matrix.Rmd index 41fa0aeeb..469a1ca7e 100644 --- a/vignettes/using-scatterplot-matrix.Rmd +++ b/vignettes/using-scatterplot-matrix.Rmd @@ -39,15 +39,14 @@ Inside this app 5 datasets will be used 5. `ADLB` A long data set with lab measurements for each subject ```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} -# nolint start data <- teal_data() data <- within(data, { - ADSL <- teal.modules.general::rADSL - ADSL2 <- teal.modules.general::rADSL %>% + ADSL <- rADSL + ADSL2 <- rADSL %>% mutate(TRTDUR = round(as.numeric(TRTEDTM - TRTSDTM), 1)) - ADRS <- teal.modules.general::rADRS - ADTTE <- teal.modules.general::rADTTE - ADLB <- teal.modules.general::rADLB %>% + ADRS <- rADRS + ADTTE <- rADTTE + ADLB <- rADLB %>% mutate(CHGC = as.factor(case_when( CHG < 1 ~ "N", CHG > 1 ~ "P", @@ -61,7 +60,6 @@ jk_adsl2 <- jk names(jk_adsl2)[names(jk_adsl2) == "ADSL"] <- "ADSL2" jk <- c(jk, jk_adsl2) jk["ADSL2", "ADSL"] <- c("USUBJID", "STUDYID") -# nolint end ``` ## Create an `app` variable @@ -72,9 +70,9 @@ itself will be constructed by multiple calls of `tm_g_scatterplotmatrix` using d combinations of data sets. ```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} -app <- teal::init( +app <- init( data = data, - modules = teal::modules( + modules = modules( modules( label = "Scatterplot matrix", # .. single wide ---- diff --git a/vignettes/using-scatterplot.Rmd b/vignettes/using-scatterplot.Rmd index 805a360e3..b1b9dc411 100644 --- a/vignettes/using-scatterplot.Rmd +++ b/vignettes/using-scatterplot.Rmd @@ -26,6 +26,7 @@ various types of datasets inside an scatter plot module: ```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} library(teal.modules.general) # used to create the app library(dplyr) # used to modify data sets +# nolint object_name_linter ``` ## Create data sets @@ -39,15 +40,14 @@ Inside this app 5 datasets will be used 5. `ADLB` A long data set with lab measurements for each subject ```{r echo=TRUE, message=FALSE, warning=FALSE, results="hide"} -# nolint start data <- teal_data() data <- within(data, { - ADSL <- teal.modules.general::rADSL - ADSL2 <- teal.modules.general::rADSL %>% + ADSL <- rADSL + ADSL2 <- rADSL %>% mutate(TRTDUR = round(as.numeric(TRTEDTM - TRTSDTM), 1)) - ADRS <- teal.modules.general::rADRS - ADTTE <- teal.modules.general::rADTTE - ADLB <- teal.modules.general::rADLB %>% + ADRS <- rADRS + ADTTE <- rADTTE + ADLB <- rADLB %>% mutate(CHGC = as.factor(case_when( CHG < 1 ~ "N", CHG > 1 ~ "P", @@ -61,7 +61,6 @@ jk_adsl2 <- jk names(jk_adsl2)[names(jk_adsl2) == "ADSL"] <- "ADSL2" jk <- c(jk, jk_adsl2) jk["ADSL2", "ADSL"] <- c("USUBJID", "STUDYID") -# nolint end ``` ## Create an `app` variable @@ -78,9 +77,9 @@ ggextra_available <- requireNamespace("ggExtra", quietly = TRUE) # 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"} -app <- teal::init( +app <- init( data = data, - modules = teal::modules( + modules = modules( modules( label = "Scatterplot", tm_g_scatterplot(