diff --git a/DESCRIPTION b/DESCRIPTION index 001d58abb..d422460b3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -46,6 +46,7 @@ Imports: htmlwidgets (>= 1.6.4), jsonlite (>= 1.8.9), lattice (>= 0.18-4), + lifecycle (>= 0.2.0), MASS (>= 7.3-61), rlistings (>= 0.2.8), rtables (>= 0.6.8), @@ -69,7 +70,6 @@ Imports: utils Suggests: knitr (>= 1.42), - lifecycle (>= 0.2.0), logger (>= 0.2.0), nestcolor (>= 0.1.0), pkgload, diff --git a/NAMESPACE b/NAMESPACE index 86c4c2a5a..9c0f1aa0f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -31,3 +31,4 @@ import(shiny) import(teal) import(teal.transform) importFrom(dplyr,"%>%") +importFrom(lifecycle,deprecated) diff --git a/NEWS.md b/NEWS.md index c0e44a9d5..45a929b1e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,11 @@ # teal.modules.general 0.3.0.9064 * Removed `Show Warnings` modals from modules. +* Soft deprecated `datasets_selected` argument of modules in favor of `datanames`. +* Soft deprecated `show_metadata` argument of `tm_front_page()` in favor of `datanames`. ### Enhancements + * Added `teal.logger` functionality for logging changes in shiny inputs in all modules. ### Bug fixes diff --git a/R/tm_data_table.R b/R/tm_data_table.R index ca259cf66..f18c5d05b 100644 --- a/R/tm_data_table.R +++ b/R/tm_data_table.R @@ -16,10 +16,8 @@ #' 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 #' dataset will initially be shown. -#' @param datasets_selected (`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 == 0` (default) then all datasets are shown. -#' Note: Only datasets of the `data.frame` class are compatible. +#' @param datasets_selected (`character`) `r lifecycle::badge("deprecated")` A vector of datasets which should be +#' shown and in what order. Use `datanames` instead. #' @param dt_args (`named list`) Additional arguments to be passed to [DT::datatable()] #' (must not include `data` or `options`). #' @param dt_options (`named list`) The `options` argument to `DT::datatable`. By default @@ -86,7 +84,8 @@ #' tm_data_table <- function(label = "Data Table", variables_selected = list(), - datasets_selected = character(0), + datasets_selected = deprecated(), + datanames = if (missing(datasets_selected)) "all" else datasets_selected, dt_args = list(), dt_options = list( searching = FALSE, @@ -111,8 +110,15 @@ tm_data_table <- function(label = "Data Table", } }) } - - checkmate::assert_character(datasets_selected, min.len = 0, min.chars = 1) + if (!missing(datasets_selected)) { + lifecycle::deprecate_soft( + when = "0.4.0", + what = "tm_data_table(datasets_selected)", + with = "tm_data_table(datanames)", + details = 'Use tm_data_table(datanames = "all") to keep the previous behavior and avoid this warning.', + ) + } + checkmate::assert_character(datanames, min.len = 0, min.chars = 1, null.ok = TRUE) checkmate::assert( checkmate::check_list(dt_args, len = 0), checkmate::check_subset(names(dt_args), choices = names(formals(DT::datatable))) @@ -128,10 +134,10 @@ tm_data_table <- function(label = "Data Table", label, server = srv_page_data_table, ui = ui_page_data_table, - datanames = if (length(datasets_selected) == 0) "all" else datasets_selected, + datanames = datanames, server_args = list( + datanames = datanames, variables_selected = variables_selected, - datasets_selected = datasets_selected, dt_args = dt_args, dt_options = dt_options, server_rendering = server_rendering @@ -180,7 +186,7 @@ ui_page_data_table <- function(id, pre_output = NULL, post_output = NULL) { # Server page module srv_page_data_table <- function(id, data, - datasets_selected, + datanames, variables_selected, dt_args, dt_options, @@ -193,16 +199,10 @@ srv_page_data_table <- function(id, if_filtered <- reactive(as.logical(input$if_filtered)) if_distinct <- reactive(as.logical(input$if_distinct)) - datanames <- isolate(names(data())) datanames <- Filter(function(name) { is.data.frame(isolate(data())[[name]]) }, datanames) - if (!identical(datasets_selected, character(0))) { - checkmate::assert_subset(datasets_selected, datanames) - datanames <- datasets_selected - } - output$dataset_table <- renderUI({ do.call( tabsetPanel, diff --git a/R/tm_front_page.R b/R/tm_front_page.R index 841b38f86..e6c2847e7 100644 --- a/R/tm_front_page.R +++ b/R/tm_front_page.R @@ -13,7 +13,10 @@ #' `HTML("html text here")`. #' @param footnotes (`character` vector) of text to be shown at the bottom of the module, for each #' element, if named the name is shown first in bold, followed by the value. -#' @param show_metadata (`logical`) indicating whether the metadata of the datasets be available on the module. +#' @param show_metadata (`logical`) `r lifecycle::badge("deprecated")` indicating +#' whether the metadata of the datasets be available on the module. +#' Metadata shown automatically when `datanames` set. +#' @inheritParams tm_variable_browser #' #' @inherit shared_params return #' @@ -50,12 +53,11 @@ #' ), #' tables = table_input, #' additional_tags = HTML("Additional HTML or shiny tags go here
"), -#' footnotes = c("X" = "is the first footnote", "Y is the second footnote"), -#' show_metadata = TRUE +#' footnotes = c("X" = "is the first footnote", "Y is the second footnote") #' ) #' ), #' header = tags$h1("Sample Application"), -#' footer = tags$p("Application footer"), +#' footer = tags$p("Application footer") #' ) #' #' if (interactive()) { @@ -69,7 +71,8 @@ tm_front_page <- function(label = "Front page", tables = list(), additional_tags = tagList(), footnotes = character(0), - show_metadata = FALSE) { + show_metadata = deprecated(), + datanames = if (missing(show_metadata)) "all" else NULL) { message("Initializing tm_front_page") # Start of assertions @@ -78,7 +81,19 @@ tm_front_page <- function(label = "Front page", checkmate::assert_list(tables, types = "data.frame", names = "named", any.missing = FALSE) checkmate::assert_multi_class(additional_tags, classes = c("shiny.tag.list", "html")) checkmate::assert_character(footnotes, min.len = 0, any.missing = FALSE) - checkmate::assert_flag(show_metadata) + if (!missing(show_metadata)) { + lifecycle::deprecate_soft( + when = "0.4.0", + what = "tm_front_page(show_metadata)", + with = "tm_front_page(datanames)", + details = c( + "With `datanames` you can select which datasets are displayed.", + i = "Use `tm_front_page(datanames = 'all')` to keep the previous behavior and avoid this warning." + ) + ) + } + checkmate::assert_character(datanames, min.len = 0, min.chars = 1, null.ok = TRUE) + # End of assertions # Make UI args @@ -89,8 +104,8 @@ tm_front_page <- function(label = "Front page", server = srv_front_page, ui = ui_front_page, ui_args = args, - server_args = list(tables = tables, show_metadata = show_metadata), - datanames = if (show_metadata) "all" else NULL + server_args = list(tables = tables), + datanames = datanames ) attr(ans, "teal_bookmarkable") <- TRUE ans @@ -120,7 +135,7 @@ ui_front_page <- function(id, ...) { class = "my-4", args$additional_tags ), - if (args$show_metadata) { + if (length(args$datanames) > 0L) { tags$div( id = "front_page_metabutton", class = "m-4", @@ -136,7 +151,7 @@ ui_front_page <- function(id, ...) { } # Server function for the front page module -srv_front_page <- function(id, data, tables, show_metadata) { +srv_front_page <- function(id, data, tables) { checkmate::assert_class(data, "reactive") checkmate::assert_class(isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { @@ -154,8 +169,7 @@ srv_front_page <- function(id, data, tables, show_metadata) { caption.placement = "top" ) }) - - if (show_metadata) { + if (length(isolate(names(data()))) > 0L) { observeEvent( input$metadata_button, showModal( modalDialog( diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index c202845a3..aa1a5e15e 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -73,7 +73,7 @@ #' app <- init( #' data = data, #' modules = modules( -#' tm_missing_data() +#' tm_missing_data(parent_dataname = "mtcars") #' ) #' ) #' if (interactive()) { @@ -109,6 +109,7 @@ tm_missing_data <- function(label = "Missing data", plot_height = c(600, 400, 5000), plot_width = NULL, + datanames = "all", parent_dataname = "ADSL", ggtheme = c("classic", "gray", "bw", "linedraw", "light", "dark", "minimal", "void"), ggplot2_args = list( @@ -134,6 +135,7 @@ tm_missing_data <- function(label = "Missing data", lower = plot_width[2], upper = plot_width[3], null.ok = TRUE, .var.name = "plot_width" ) + checkmate::assert_character(datanames, min.len = 0, min.chars = 1, null.ok = TRUE) checkmate::assert_character(parent_dataname, min.len = 0, max.len = 1) ggtheme <- match.arg(ggtheme) @@ -152,6 +154,7 @@ tm_missing_data <- function(label = "Missing data", ans <- module( label, server = srv_page_missing_data, + datanames = if (identical(datanames, "all")) union(datanames, parent_dataname) else "all", server_args = list( parent_dataname = parent_dataname, plot_height = plot_height, @@ -161,7 +164,6 @@ tm_missing_data <- function(label = "Missing data", decorators = decorators ), ui = ui_page_missing_data, - datanames = "all", ui_args = list(pre_output = pre_output, post_output = post_output) ) attr(ans, "teal_bookmarkable") <- TRUE diff --git a/R/tm_variable_browser.R b/R/tm_variable_browser.R index 66d116f88..74ab4e012 100644 --- a/R/tm_variable_browser.R +++ b/R/tm_variable_browser.R @@ -10,14 +10,12 @@ #' @inheritParams teal::module #' @inheritParams shared_params #' @param parent_dataname (`character(1)`) string specifying a parent dataset. -#' If it exists in `datasets_selected`then an extra checkbox will be shown to +#' If it exists in `datanames` then an extra checkbox will be shown to #' allow users to not show variables in other datasets which exist in this `dataname`. #' This is typically used to remove `ADSL` columns in `CDISC` data. #' In non `CDISC` data this can be ignored. Defaults to `"ADSL"`. -#' @param datasets_selected (`character`) vector of datasets which should be -#' shown, in order. Names must correspond with datasets names. -#' If vector of length zero (default) then all datasets are shown. -#' Note: Only `data.frame` objects are compatible; using other types will cause an error. +#' @param datasets_selected (`character`) `r lifecycle::badge("deprecated")` vector of datasets to show, please +#' use the `datanames` argument. #' #' @inherit shared_params return #' @@ -81,7 +79,8 @@ #' @export #' tm_variable_browser <- function(label = "Variable Browser", - datasets_selected = character(0), + datasets_selected = deprecated(), + datanames = if (missing(datasets_selected)) "all" else datasets_selected, parent_dataname = "ADSL", pre_output = NULL, post_output = NULL, @@ -90,22 +89,37 @@ tm_variable_browser <- function(label = "Variable Browser", # Start of assertions checkmate::assert_string(label) - checkmate::assert_character(datasets_selected) + if (!missing(datasets_selected)) { + lifecycle::deprecate_soft( + when = "0.4.0", + what = "tm_variable_browser(datasets_selected)", + with = "tm_variable_browser(datanames)", + details = c( + "If both `datasets_selected` and `datanames` are set `datasets_selected` will be silently ignored.", + i = 'Use `tm_variable_browser(datanames = "all")` to keep the previous behavior and avoid this warning.' + ) + ) + } + checkmate::assert_character(datanames, min.len = 0, min.chars = 1, null.ok = TRUE) checkmate::assert_character(parent_dataname, min.len = 0, max.len = 1) checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_class(ggplot2_args, "ggplot2_args") # End of assertions - datasets_selected <- unique(datasets_selected) + datanames <- if (identical(datanames, "all")) { + "all" + } else { + union(datanames, parent_dataname) + } ans <- module( label, server = srv_variable_browser, ui = ui_variable_browser, - datanames = "all", + datanames = datanames, server_args = list( - datasets_selected = datasets_selected, + datanames = datanames, parent_dataname = parent_dataname, ggplot2_args = ggplot2_args ), @@ -194,7 +208,7 @@ srv_variable_browser <- function(id, data, reporter, filter_panel_api, - datasets_selected, parent_dataname, ggplot2_args) { + datanames, parent_dataname, ggplot2_args) { with_reporter <- !missing(reporter) && inherits(reporter, "Reporter") with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI") checkmate::assert_class(data, "reactive") @@ -212,18 +226,10 @@ srv_variable_browser <- function(id, varname_numeric_as_factor <- reactiveValues() - datanames <- isolate(names(data())) datanames <- Filter(function(name) { is.data.frame(isolate(data())[[name]]) }, datanames) - checkmate::assert_character(datasets_selected) - checkmate::assert_subset(datasets_selected, datanames) - if (!identical(datasets_selected, character(0))) { - checkmate::assert_subset(datasets_selected, datanames) - datanames <- datasets_selected - } - output$ui_variable_browser <- renderUI({ ns <- session$ns do.call( diff --git a/R/zzz.R b/R/zzz.R index 66210152b..2ccb87747 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -6,4 +6,5 @@ ### global variables ggplot_themes <- c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void") +#' @importFrom lifecycle deprecated interactive <- NULL diff --git a/man/tm_data_table.Rd b/man/tm_data_table.Rd index 9fda79408..20422a567 100644 --- a/man/tm_data_table.Rd +++ b/man/tm_data_table.Rd @@ -7,7 +7,8 @@ tm_data_table( label = "Data Table", variables_selected = list(), - datasets_selected = character(0), + datasets_selected = deprecated(), + datanames = if (missing(datasets_selected)) "all" else datasets_selected, dt_args = list(), dt_options = list(searching = FALSE, pageLength = 30, lengthMenu = c(5, 15, 30, 100), scrollX = TRUE), @@ -26,10 +27,17 @@ Names of list elements should correspond to the names of the datasets available If no entry is specified for a dataset, the first six variables from that dataset will initially be shown.} -\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 \code{length == 0} (default) then all datasets are shown. -Note: Only datasets of the \code{data.frame} class are compatible.} +\item{datasets_selected}{(\code{character}) \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} A vector of datasets which should be +shown and in what order. Use \code{datanames} instead.} + +\item{datanames}{(\code{character}) Names of the datasets relevant to the item. +There are 2 reserved values that have specific behaviors: +\itemize{ +\item The keyword \code{"all"} includes all datasets available in the data passed to the teal application. +\item \code{NULL} hides the sidebar panel completely. +\item If \code{transformators} are specified, their \code{datanames} are automatically added to this \code{datanames} +argument. +}} \item{dt_args}{(\verb{named list}) Additional arguments to be passed to \code{\link[DT:datatable]{DT::datatable()}} (must not include \code{data} or \code{options}).} diff --git a/man/tm_front_page.Rd b/man/tm_front_page.Rd index b19d33651..c18930200 100644 --- a/man/tm_front_page.Rd +++ b/man/tm_front_page.Rd @@ -10,7 +10,8 @@ tm_front_page( tables = list(), additional_tags = tagList(), footnotes = character(0), - show_metadata = FALSE + show_metadata = deprecated(), + datanames = if (missing(show_metadata)) "all" else NULL ) } \arguments{ @@ -30,7 +31,18 @@ for example to include an image, \code{tagList(tags$img(src = "image.png"))} or \item{footnotes}{(\code{character} vector) of text to be shown at the bottom of the module, for each element, if named the name is shown first in bold, followed by the value.} -\item{show_metadata}{(\code{logical}) indicating whether the metadata of the datasets be available on the module.} +\item{show_metadata}{(\code{logical}) \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} indicating +whether the metadata of the datasets be available on the module. +Metadata shown automatically when \code{datanames} set.} + +\item{datanames}{(\code{character}) Names of the datasets relevant to the item. +There are 2 reserved values that have specific behaviors: +\itemize{ +\item The keyword \code{"all"} includes all datasets available in the data passed to the teal application. +\item \code{NULL} hides the sidebar panel completely. +\item If \code{transformators} are specified, their \code{datanames} are automatically added to this \code{datanames} +argument. +}} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. @@ -68,12 +80,11 @@ app <- init( ), tables = table_input, additional_tags = HTML("Additional HTML or shiny tags go here
"), - footnotes = c("X" = "is the first footnote", "Y is the second footnote"), - show_metadata = TRUE + footnotes = c("X" = "is the first footnote", "Y is the second footnote") ) ), header = tags$h1("Sample Application"), - footer = tags$p("Application footer"), + footer = tags$p("Application footer") ) if (interactive()) { @@ -84,8 +95,8 @@ if (interactive()) { \section{Examples in Shinylive}{ \describe{ \item{example-1}{ - \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqX8opKAeNdqAfQ8vG3dPbyNdAHdaUgALFXYgqFxdECVdXUY4AEdBWiz2CDFSYmoiRkUIDIBBABEAZQAZH10-DCTEREY6pvTdT1JGdh7GlIUweC8k8dsIulFSdnHqwTjy8d0AXl1xgDlnertWuFhxsbAk-1EiQUYCOA3t8dFWMli4TQJdabBKgF9KgArIgqfwAazgrFEiTCs2M-DgJigwlI-gI-FoogI-mBoIhUOA0Hg0KScgAum4yFB6CJ-ABGFpJDAmZjwdgASQgJiIW10BCWYGqZx2YAAQjMUnY4AAPUi8-nLYXjcW-SpeGlwfwAJkZYWZrLg7AABgBhIjUQQwKp0o3ygUmpVgWoS3Sm82Wqpa23bfkAVgwvpSADYMEG5Ck3RarboAMzevkCoV4EUquRq6m0mO6rz62CGzncu3jVzJ8YAMRdUtlRbAAHFHQAJGaVJTq2kqVCrFrzRZ9cZ2DN6OmPVqD+m4PtgAca3RakdtzVaidVEXTkSx+djmNKFvQdAtFQxJYrpK8pLLjJ8IQiUS8q-CMTHjIZUgwfwskio1BQKRP58Zd4oARRh-HIasfT-f8MnGdkYFQcovDIXQVG5RgYE8KwIBHGC5QIKAqgkHl3iyDAzj6KCRQAeTiGRkK5cp0M0EhsLAE18N0QjdGIuBSLAcjn3DfiX0HW9tgXfwO1WC8oKAjEmOgAIvAkUTdAbOwAFlGkTfg5Mw7hVI05pyl0UR4ggVhR2UjiiJkPR9CYAA+CUhNMIgiFICB3LEGsAA0WMxVp3lMfIFlc9zPPIR0AE1kNvGiTLgYgIH4MKPK85yV3-UyiEifxJiAsJeQcFx+MqDJBJXQDgN5JTRAAEliOkBXqWBUHXap0DoPD5IyjJuS8xgap-erUETTraG6zDUpkDLd1oExdHYFRyGYSwdBsWw0hXUyVFYDrRrQVA6ryFJDrq0QZB0ColD+JQwD+MkgA}{Open in Shinylive} - \if{html}{\out{}} + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqX8opKAeNdqAfQ8vG3dPbyNdAHdaUgALFXYgqFxdECVdXUY4AEdBWiz2CDFSYmoiRkUIDIBBABEAZQAZH10-DCTEREY6pvTdT1JGdh7GlIUweC8k8dsIulFSdnHqwTjy8d0AXl1xgDlnertWuFhxsbAk-1EiQUYCOA3t8dFWMli4TQJdabBKgF9KgArIgqfwAazgrFEiTCs2M-DgJigwlI-gI-FoogI-mBoIhUOA0Hg0KScgAum4yFB6CJ-ABGFpJDAmZjwdgASQgJiIW10BCWYGqZx2YAAQjMUnY4AAPUi8-nLYXjcW-SpeGlwfwAJkZYWZrLg7AABgBhIjUQQwKp0o3ygUmpVgWoS3Sm82Wqpa23bfkAVgwvpSADYMEG5Ck3RarboAMzevkCoV4EUquRq6m0mO6rz62CGzncu3jVzJ8YAMRdUtlRbAAHFHQAJGaVJTq2kqVCrFrzRZ9cZ2DN6OmPVqD+m4PtgAca3RakdtzVaidVEXTkSx+djmNKFvQdAtFQxJYrpK8pLLjJ8IQiUS8q-CMTHjIZUgwfwskio1BQKRP58Zd4oARRh-HIasfT-f8MnGdkYFQcovDIXQVG5RgYE8KwIBHGC5QIKAqgkHl3iyDAzj6KCRQAeTiGRkK5cp0M0EhsLAE18N0QjdGIuBSLAcjn3DfiX0HW9tgXfwO1WC8oKAjEmOgAIvAkUTdAbOwAFlGkTfg5Mw7hVI05pyl0UR4ggVhR2UjiiJkPR9CYAA+CUhNMIgiFICB3LEGsAA0WMxVp3lMfIFlc9zPPIR0AE1kNvGiTLgYgIH4MKPK8mZ+MqDJBJXQDgN5JTRAAEliOkBXqWBUHXap0DoPD5OclduS8xgCp-YrUETWraHqzDUpkDKIF3WgTF0dgVHIZhLB0GxbDSFdTJUVgas6tBUCKvIUjWorRBkHQKiUP4lDAP4ySAA}{Open in Shinylive} + \if{html}{\out{}} \if{html}{\out{}} } } diff --git a/man/tm_missing_data.Rd b/man/tm_missing_data.Rd index ccdad6af6..0969c1018 100644 --- a/man/tm_missing_data.Rd +++ b/man/tm_missing_data.Rd @@ -8,6 +8,7 @@ tm_missing_data( label = "Missing data", plot_height = c(600, 400, 5000), plot_width = NULL, + datanames = "all", parent_dataname = "ADSL", ggtheme = c("classic", "gray", "bw", "linedraw", "light", "dark", "minimal", "void"), ggplot2_args = list(`Combinations Hist` = teal.widgets::ggplot2_args(labs = @@ -28,6 +29,15 @@ For \code{modules()} defaults to \code{"root"}. See \code{Details}.} \item{plot_width}{(\code{numeric}) optional, specifies the plot width as a three-element vector of \code{value}, \code{min}, and \code{max} for a slider encoding the plot width.} +\item{datanames}{(\code{character}) Names of the datasets relevant to the item. +There are 2 reserved values that have specific behaviors: +\itemize{ +\item The keyword \code{"all"} includes all datasets available in the data passed to the teal application. +\item \code{NULL} hides the sidebar panel completely. +\item If \code{transformators} are specified, their \code{datanames} are automatically added to this \code{datanames} +argument. +}} + \item{parent_dataname}{(\code{character(1)}) Specifies the parent dataset name. Default is \code{ADSL} for \code{CDISC} data. If provided and exists, enables additional analysis "by subject". For non-\code{CDISC} data, this parameter can be ignored.} @@ -120,7 +130,7 @@ data <- within(data, { app <- init( data = data, modules = modules( - tm_missing_data() + tm_missing_data(parent_dataname = "mtcars") ) ) if (interactive()) { @@ -150,8 +160,8 @@ if (interactive()) { \section{Examples in Shinylive}{ \describe{ \item{example-1}{ - \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXVIhrquuAAesKgiuvxQpFBK4ZEGxlzUAPoxUDbREVBxugDutKQAFirsKbi6IEq6uoxwAI6CtNXsPqKkxNREjIoQFbpQ-PyJ0KJZZhaa1gG25RCVlQHAosEi7KK1idwkEuyTpSbtHewiEBIF27YAVFXmtCbsAIylGAAMAKyPdwDsct8AulkAcgBBHpzHoAXzcM10DVowyM0MYsJ6MFaLDhxhRBDRkMqMNEwD+8OoaBCHDxpT6AyGXUqmLRBKyxPQ1A4dMYogp-UGUFENN0bPxwAUhFY1GFP0Jxh5GBM6lIBwFwCFIrFYAlfMVyqkLHFkt64llGgVqPZSuF2sYuq6YK6ShJWRUeXYPRSugAvGEMrhkQJhGJ3fzfSJRM6oZVSDBEjBYaIVBJkhk0lCul0brp2CpyMxLDobFMeqJChBWID0OwSQASeoU9AV1aMHSdJQQiBgME-IA}{Open in Shinylive} - \if{html}{\out{}} + \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXVIhrquuAAesKgiuvxQpFBK4ZEGxlzUAPoxUDbREVBxugDutKQAFirsKbi6IEq6uoxwAI6CtNXsPqKkxNREjIoQFbpQ-PyJ0KJZZhaa1gG25RCVlQHAosEi7KK1idwkEuyTpSbtHewiEBIF27YAVFXmtCbsAIylGAAMAKyPdwDsct8AulkAcgBBHpzHoAXzcM10DVowyM0MYsJ6MFaLDhxhRBDRkMqMNEwD+8OoaBCHDxpT6AyGXUqmLRBKyxPQ1A4dMYogp-UGUFENN0bPxwAUhFY1GFP0Jxh5GBM6lIBwFwCFIrFYAlfMVyqkLHFkt64llGgVqPZSuF2sYuq6YK6ShJWRUeXYPRSugAvGEMrhkQJhGJ3fzfSJRM6oZVSDBEjBYaIVBJkhl2KgWBRSAnItB4AHhQLhXyul0brp2CpyMxLDobFMeqJChBWID0OwSQASeoU9At1aMHSdJQQiBgME-IA}{Open in Shinylive} + \if{html}{\out{}} \if{html}{\out{}} } \item{example-2}{ diff --git a/man/tm_variable_browser.Rd b/man/tm_variable_browser.Rd index 211c84bb4..780a19731 100644 --- a/man/tm_variable_browser.Rd +++ b/man/tm_variable_browser.Rd @@ -6,7 +6,8 @@ \usage{ tm_variable_browser( label = "Variable Browser", - datasets_selected = character(0), + datasets_selected = deprecated(), + datanames = if (missing(datasets_selected)) "all" else datasets_selected, parent_dataname = "ADSL", pre_output = NULL, post_output = NULL, @@ -17,13 +18,20 @@ tm_variable_browser( \item{label}{(\code{character(1)}) Label shown in the navigation item for the module or module group. For \code{modules()} defaults to \code{"root"}. See \code{Details}.} -\item{datasets_selected}{(\code{character}) vector of datasets which should be -shown, in order. Names must correspond with datasets names. -If vector of length zero (default) then all datasets are shown. -Note: Only \code{data.frame} objects are compatible; using other types will cause an error.} +\item{datasets_selected}{(\code{character}) \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} vector of datasets to show, please +use the \code{datanames} argument.} + +\item{datanames}{(\code{character}) Names of the datasets relevant to the item. +There are 2 reserved values that have specific behaviors: +\itemize{ +\item The keyword \code{"all"} includes all datasets available in the data passed to the teal application. +\item \code{NULL} hides the sidebar panel completely. +\item If \code{transformators} are specified, their \code{datanames} are automatically added to this \code{datanames} +argument. +}} \item{parent_dataname}{(\code{character(1)}) string specifying a parent dataset. -If it exists in \code{datasets_selected}then an extra checkbox will be shown to +If it exists in \code{datanames} then an extra checkbox will be shown to allow users to not show variables in other datasets which exist in this \code{dataname}. This is typically used to remove \code{ADSL} columns in \code{CDISC} data. In non \code{CDISC} data this can be ignored. Defaults to \code{"ADSL"}.} diff --git a/tests/testthat/test-shinytest2-tm_data_table.R b/tests/testthat/test-shinytest2-tm_data_table.R index c6330d43d..1b4bf3217 100644 --- a/tests/testthat/test-shinytest2-tm_data_table.R +++ b/tests/testthat/test-shinytest2-tm_data_table.R @@ -6,7 +6,7 @@ app_driver_tm_data_table <- function() { variables_selected = list( iris = c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width", "Species") ), - datasets_selected = c("iris", "mtcars"), + datanames = c("iris", "mtcars"), dt_args = list(caption = "Table Caption"), dt_options = list( searching = FALSE, pageLength = 30, lengthMenu = c(5, 15, 30, 100), diff --git a/tests/testthat/test-shinytest2-tm_front_page.R b/tests/testthat/test-shinytest2-tm_front_page.R index c329db949..febb35638 100644 --- a/tests/testthat/test-shinytest2-tm_front_page.R +++ b/tests/testthat/test-shinytest2-tm_front_page.R @@ -14,8 +14,7 @@ app_driver_tm_front_page <- function() { ), tables = list("MTCARS" = head(mtcars, 5), "IRIS" = head(iris, 5)), additional_tags = HTML("Additional HTML or shiny tags go here"), - footnotes = "This is a footnote", - show_metadata = TRUE + footnotes = "This is a footnote" ), timeout = 3000 ) diff --git a/tests/testthat/test-shinytest2-tm_misssing_data.R b/tests/testthat/test-shinytest2-tm_misssing_data.R index debfcc1b1..96d151bd3 100644 --- a/tests/testthat/test-shinytest2-tm_misssing_data.R +++ b/tests/testthat/test-shinytest2-tm_misssing_data.R @@ -19,7 +19,7 @@ app_driver_tm_missing_data <- function() { label = "Missing data", plot_height = c(600, 400, 5000), plot_width = NULL, - parent_dataname = "", + datanames = "mtcars", ggtheme = "gray", ggplot2_args = list( "Combinations Hist" = teal.widgets::ggplot2_args( diff --git a/tests/testthat/test-shinytest2-tm_variable_browser.R b/tests/testthat/test-shinytest2-tm_variable_browser.R index abf5680f8..76b26b04e 100644 --- a/tests/testthat/test-shinytest2-tm_variable_browser.R +++ b/tests/testthat/test-shinytest2-tm_variable_browser.R @@ -15,7 +15,7 @@ app_driver_tm_variable_browser <- function() { data = data, modules = tm_variable_browser( label = "Variable browser (e2e)", - datasets_selected = c("iris", "mtcars", "women", "faithful", "CO2"), + datanames = c("iris", "mtcars", "women", "faithful", "CO2"), parent_dataname = "CO2", ggplot2_args = teal.widgets::ggplot2_args( labs = list(subtitle = "Plot generated by Variable Browser Module") diff --git a/vignettes/using-data-table.Rmd b/vignettes/using-data-table.Rmd index 46ccde3ea..8874e0321 100644 --- a/vignettes/using-data-table.Rmd +++ b/vignettes/using-data-table.Rmd @@ -72,7 +72,7 @@ mod2 <- tm_data_table( "PARAM", "PARAMCD", "AVISIT", "AVISITN", "AVAL", "CHG" ) ), - datasets_selected = c("ADTTE", "ADLB", "ADSL") + datanames = c("ADTTE", "ADLB", "ADSL") ) # configuration for the advanced usage of DT options and extensions