diff --git a/R/tm_g_lineplot.R b/R/tm_g_lineplot.R index d2e46351b..833f99c77 100644 --- a/R/tm_g_lineplot.R +++ b/R/tm_g_lineplot.R @@ -5,6 +5,7 @@ #' @inheritParams tern::g_lineplot #' @inheritParams tern::control_lineplot_vars #' @inheritParams template_arguments +#' @param strata `r lifecycle::badge("deprecated")` Please use the `group_var` argument instead. #' @param group_var (`string` or `NA`)\cr group variable name. #' @param param (`character`)\cr parameter to filter the data by. #' @param incl_screen (`logical`)\cr whether the screening visit should be included. @@ -22,6 +23,7 @@ #' #' @keywords internal template_g_lineplot <- function(dataname = "ANL", + strata = lifecycle::deprecated(), group_var = "ARM", x = "AVISIT", y = "AVAL", @@ -40,6 +42,15 @@ template_g_lineplot <- function(dataname = "ANL", title = "Line Plot", y_lab = "", ggplot2_args = teal.widgets::ggplot2_args()) { + if (lifecycle::is_present(strata)) { + warning( + "The `strata` argument of `tm_g_lineplot()` is deprecated as of teal.modules.clinical 0.9.1. ", + "Please use the `group_var` argument instead.", + call. = FALSE + ) + group_var <- strata + } + checkmate::assert_string(dataname) checkmate::assert_string(group_var) checkmate::assert_string(x) @@ -255,11 +266,8 @@ template_g_lineplot <- function(dataname = "ANL", #' @export tm_g_lineplot <- function(label, dataname, - parentname = ifelse( - inherits(group_var, "data_extract_spec"), - teal.transform::datanames_input(group_var), - "ADSL" - ), + parentname = NULL, + strata = lifecycle::deprecated(), group_var = teal.transform::choices_selected( teal.transform::variable_choices(parentname, c("ARM", "ARMCD", "ACTARMCD")), "ARM" ), @@ -294,6 +302,21 @@ tm_g_lineplot <- function(label, pre_output = NULL, post_output = NULL, ggplot2_args = teal.widgets::ggplot2_args()) { + if (lifecycle::is_present(strata)) { + warning( + "The `strata` argument of `tm_g_lineplot()` is deprecated as of teal.modules.clinical 0.9.1. ", + "Please use the `group_var` argument instead.", + call. = FALSE + ) + group_var <- strata + } + + # Now handle 'parentname' calculation based on 'group_var' + parentname <- ifelse( + inherits(group_var, "data_extract_spec"), + teal.transform::datanames_input(group_var), + "ADSL" + ) message("Initializing tm_g_lineplot") checkmate::assert_string(label) checkmate::assert_string(dataname) diff --git a/man/template_g_lineplot.Rd b/man/template_g_lineplot.Rd index 8eb9e581c..f1941082f 100644 --- a/man/template_g_lineplot.Rd +++ b/man/template_g_lineplot.Rd @@ -6,6 +6,7 @@ \usage{ template_g_lineplot( dataname = "ANL", + strata = lifecycle::deprecated(), group_var = "ARM", x = "AVISIT", y = "AVAL", @@ -29,6 +30,8 @@ template_g_lineplot( \arguments{ \item{dataname}{(\code{character})\cr analysis data used in teal module.} +\item{strata}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Please use the \code{group_var} argument instead.} + \item{group_var}{(\code{string} or \code{NA})\cr group variable name.} \item{x}{(\code{string})\cr x-variable name.} diff --git a/man/tm_g_lineplot.Rd b/man/tm_g_lineplot.Rd index 07b429777..84504eb8d 100644 --- a/man/tm_g_lineplot.Rd +++ b/man/tm_g_lineplot.Rd @@ -7,8 +7,8 @@ tm_g_lineplot( label, dataname, - parentname = ifelse(inherits(group_var, "data_extract_spec"), - teal.transform::datanames_input(group_var), "ADSL"), + parentname = NULL, + strata = lifecycle::deprecated(), group_var = teal.transform::choices_selected(teal.transform::variable_choices(parentname, c("ARM", "ARMCD", "ACTARMCD")), "ARM"), @@ -45,6 +45,8 @@ tm_g_lineplot( \item{parentname}{(\code{character})\cr parent analysis data used in teal module, usually this refers to \code{ADSL}.} +\item{strata}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Please use the \code{group_var} argument instead.} + \item{group_var}{(\code{string} or \code{NA})\cr group variable name.} \item{x}{(\code{string})\cr x-variable name.}