Skip to content

Commit

Permalink
start deprecation cycle for strata variable
Browse files Browse the repository at this point in the history
  • Loading branch information
ayogasekaram committed Nov 18, 2024
1 parent dfee47c commit e79c4fd
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
33 changes: 28 additions & 5 deletions R/tm_g_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -22,6 +23,7 @@
#'
#' @keywords internal
template_g_lineplot <- function(dataname = "ANL",
strata = lifecycle::deprecated(),
group_var = "ARM",
x = "AVISIT",
y = "AVAL",
Expand All @@ -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)
Expand Down Expand Up @@ -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"
),
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions man/template_g_lineplot.Rd

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

6 changes: 4 additions & 2 deletions man/tm_g_lineplot.Rd

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

0 comments on commit e79c4fd

Please sign in to comment.