diff --git a/.lycheeignore b/.lycheeignore index cd1db9190..be3b4cf52 100644 --- a/.lycheeignore +++ b/.lycheeignore @@ -6,3 +6,4 @@ https://packagemanager.rstudio.com/cran/__linux__/focal/latest https://raw.githubusercontent.com/pharmaverse/admiral/main/inst/cheatsheet/cheatsheet_image.png https://rsc.niaid.nih.gov/clinical-research-sites/daids-adverse-event-grading-tables https://rsc.niaid.nih.gov/sites/default/files/daidsgradingcorrectedv21.pdf +https://www.fda.gov/media/116737/download diff --git a/DESCRIPTION b/DESCRIPTION index 5da24c18e..bc8542e4b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: admiral Title: ADaM in R Asset Library -Version: 1.1.1.9006 +Version: 1.1.1.9007 Authors@R: c( person("Ben", "Straub", , "ben.x.straub@gsk.com", role = c("aut", "cre")), person("Stefan", "Bundfuss", role = "aut", diff --git a/NEWS.md b/NEWS.md index 8a050ff2c..52632e3be 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,28 @@ ## Updates of Existing Functions ## Breaking Changes + +- The following function arguments are entering the next phase of the deprecation process: (#2487) + +### Phase 1 (warning) + +### Phase 2 (error) + +### Phase 3 (removed) + - `consolidate_metadata(check_keys)` + - Removed at v1.1.1 `compute_egfr(wt)` + - Removed at v1.1.1 `derive_expected_records(dataset_expected_obs)` + - Removed at v1.1.1 `derive_locf_records(dataset_expected_obs)` + - `derive_extreme_event(ignore_event_order)` + - `derive_vars_merged(match_flag)` + - `derive_var_merged_summary(new_var, analysis_var, summary_fun)` + - Removed at v1.1.1 `derive_param_computed(analysis_value, analysis_var)` + - `derive_param_exposure(filter, analysis_var, summary_fun)` + - `derive_summary_records(filter)` + - Removed at v1.1.1 `derive_extreme_records(filter)` + - `derive_var_joined_exist_flag(first_cond, filter)` + - `event_joined(first_cond)` + - `filter_joined(first_cond, filter)` ## Documentation diff --git a/R/consolidate_metadata.R b/R/consolidate_metadata.R index e51e57851..697ead6e6 100644 --- a/R/consolidate_metadata.R +++ b/R/consolidate_metadata.R @@ -28,16 +28,6 @@ #' #' *Permitted Values*: `"none"`, `"message"`, `"warning"`, `"error"` #' -#' @param check_keys Check keys? -#' -#' `r lifecycle::badge("deprecated")` Please use `check_type` instead. -#' -#' If `"warning"` or `"error"` is specified, a message is issued if the key -#' variables (`key_vars`) are not a unique key in all of the input datasets -#' (`datasets`). -#' -#' *Permitted Values*: `"none"`, `"warning"`, `"error"` -#' #' @param check_type Check uniqueness? #' #' If `"warning"` or `"error"` is specified, a message is issued if the key @@ -89,7 +79,6 @@ consolidate_metadata <- function(datasets, key_vars, source_var = SOURCE, check_vars = "warning", - check_keys, check_type = "error") { assert_list_of(datasets, cls = "data.frame", named = TRUE) assert_vars(key_vars) @@ -100,20 +89,6 @@ consolidate_metadata <- function(datasets, values = c("none", "message", "warning", "error"), case_sensitive = FALSE ) - if (!is_missing(check_keys)) { - deprecate_stop( - "1.1.0", - "consolidate_metadata(check_keys = )", - "consolidate_metadata(check_type = )" - ) - check_type <- - assert_character_scalar( - check_keys, - values = c("none", "warning", "error"), - case_sensitive = FALSE, - optional = TRUE - ) - } check_type <- assert_character_scalar( check_type, diff --git a/R/derive_extreme_event.R b/R/derive_extreme_event.R index 9ddf26fc0..bde991cc5 100644 --- a/R/derive_extreme_event.R +++ b/R/derive_extreme_event.R @@ -51,22 +51,6 @@ #' A named list of datasets is expected. The `dataset_name` field of `event()` #' and `event_joined()` refers to the dataset provided in the list. #' -#' @param ignore_event_order Ignore event order -#' -#' `r lifecycle::badge("deprecated")` -#' -#' This argument is *deprecated*. If event order should be ignored, please -#' specify neither `ignore_event_order` nor `tmp_event_nr_var`. If the event -#' order should be considered, don't specify `ignore_event_order` but specify -#' `tmp_event_nr_var` and and the specified variable to `order`. -#' -#' If the argument is set to `TRUE`, all events defined by `events` are -#' considered equivalent. If there is more than one observation per by group -#' the first or last (with respect to `mode` and `order`) is select without -#' taking the order of the events into account. -#' -#' *Permitted Values:* `TRUE`, `FALSE` -#' #' @param keep_source_vars Variables to keep from the source dataset #' #' For each event the specified variables are kept from the selected @@ -353,7 +337,6 @@ derive_extreme_event <- function(dataset = NULL, order, mode, source_datasets = NULL, - ignore_event_order = NULL, check_type = "warning", set_values_to = NULL, keep_source_vars = exprs(everything())) { @@ -382,27 +365,6 @@ derive_extreme_event <- function(dataset = NULL, ) ) - if (!is.null(ignore_event_order)) { - if (ignore_event_order) { - deprecate_details <- paste( - "The event order is ignored by default.", - "Please remove `ignore_event_order = TRUE` from the call.", - sep = "\n" - ) - } else { - deprecate_details <- c( - "Please remove `ignore_event_order = FALSE` from the call.", - "Specify `tmp_event_nr_var`.", - "Add the specified variable to `order`." - ) - } - deprecate_stop( - "1.1.0", - "derive_extreme_event(ignore_event_order=)", - "derive_extreme_event(tmp_event_nr_var=)", - details = deprecate_details - ) - } tmp_event_nr_var <- assert_symbol(enexpr(tmp_event_nr_var), optional = TRUE) check_type <- assert_character_scalar( diff --git a/R/derive_merged.R b/R/derive_merged.R index 322e6a5c0..d32e8089f 100644 --- a/R/derive_merged.R +++ b/R/derive_merged.R @@ -77,17 +77,6 @@ #' #' *Permitted Values*: `"first"`, `"last"`, `NULL` #' -#' @param match_flag Match flag -#' -#' `r lifecycle::badge("deprecated")` Please use `exist_flag` instead. -#' -#' If the argument is specified (e.g., `match_flag = FLAG`), the specified -#' variable (e.g., `FLAG`) is added to the input dataset. This variable will -#' be `TRUE` for all selected records from `dataset_add` which are merged into -#' the input dataset, and `NA` otherwise. -#' -#' *Permitted Values*: Variable name -#' #' @param exist_flag Exist flag #' #' If the argument is specified (e.g., `exist_flag = FLAG`), the specified @@ -321,7 +310,6 @@ derive_vars_merged <- function(dataset, new_vars = NULL, filter_add = NULL, mode = NULL, - match_flag, exist_flag = NULL, true_value = "Y", false_value = NA_character_, @@ -344,14 +332,7 @@ derive_vars_merged <- function(dataset, extract_vars(new_vars) ) ) - if (!is_missing(enexpr(match_flag))) { - deprecate_stop( - "1.1.0", - "derive_vars_merged(match_flag =)", - "derive_vars_merged(exist_flag =)" - ) - exist_flag <- assert_symbol(enexpr(match_flag), optional = TRUE) - } + exist_flag <- assert_symbol(enexpr(exist_flag), optional = TRUE) assert_atomic_vector(true_value, optional = TRUE) assert_atomic_vector(false_value, optional = TRUE) @@ -814,13 +795,6 @@ get_not_mapped <- function() { #' The variables specified by the `by_vars` and the variables used on the left #' hand sides of the `new_vars` arguments are expected. #' -#' @param new_var Variable to add -#' -#' `r lifecycle::badge("deprecated")` Please use `new_vars` instead. -#' -#' The specified variable is added to the input dataset (`dataset`) and set to -#' the summarized values. -#' #' @param by_vars Grouping variables #' #' The expressions on the left hand sides of `new_vars` are evaluated by the @@ -855,21 +829,6 @@ get_not_mapped <- function() { #' #' *Permitted Values*: a condition #' -#' @param analysis_var Analysis variable -#' -#' `r lifecycle::badge("deprecated")` Please use `new_vars` instead. -#' -#' The values of the specified variable are summarized by the function -#' specified for `summary_fun`. -#' -#' @param summary_fun Summary function -#' -#' `r lifecycle::badge("deprecated")` Please use `new_vars` instead. -#' -#' The specified function that takes as input `analysis_var` and performs the -#' calculation. This can include built-in functions as well as user defined -#' functions, for example `mean` or `function(x) mean(x, na.rm = TRUE)`. -#' #' @inheritParams derive_vars_merged #' #' @details @@ -959,11 +918,8 @@ derive_var_merged_summary <- function(dataset, dataset_add, by_vars, new_vars = NULL, - new_var, filter_add = NULL, - missing_values = NULL, - analysis_var, - summary_fun) { + missing_values = NULL) { assert_vars(by_vars) by_vars_left <- replace_values_by_names(by_vars) by_vars_right <- chr2vars(paste(vars2chr(by_vars))) @@ -980,18 +936,6 @@ derive_var_merged_summary <- function(dataset, required_vars = expr_c(by_vars_right, extract_vars(new_vars)) ) - if (!missing(new_var) || !missing(analysis_var) || !missing(summary_fun)) { - deprecate_stop( - "1.1.0", - I("derive_var_merged_summary(new_var = , anaylsis_var = , summary_fun = )"), - "derive_var_merged_summary(new_vars = )" - ) - new_var <- assert_symbol(enexpr(new_var)) - analysis_var <- assert_symbol(enexpr(analysis_var)) - assert_s3_class(summary_fun, "function") - new_vars <- exprs(!!new_var := {{ summary_fun }}(!!analysis_var), !!!new_vars) - } - # Summarise the analysis value and merge to the original dataset derive_vars_merged( dataset, diff --git a/R/derive_param_exposure.R b/R/derive_param_exposure.R index bec404c3e..0b77e9cea 100644 --- a/R/derive_param_exposure.R +++ b/R/derive_param_exposure.R @@ -13,23 +13,6 @@ #' Observations from the specified dataset are going to be used to calculate and added #' as new records to the input dataset (`dataset`). #' -#' -#' @param filter -#' -#' `r lifecycle::badge("deprecated")` Please use `filter_add` instead. -#' -#' Filter condition as logical expression to apply during -#' summary calculation. By default, filtering expressions are computed within -#' `by_vars` as this will help when an aggregating, lagging, or ranking -#' function is involved. -#' -#' For example, -#' -#' + `filter = (AVAL > mean(AVAL, na.rm = TRUE))` will filter all `AVAL` -#' values greater than mean of `AVAL` with in `by_vars`. -#' + `filter = (dplyr::n() > 2)` will filter n count of `by_vars` greater -#' than 2. -#' #' @param filter_add Filter condition as logical expression to apply during #' summary calculation. By default, filtering expressions are computed within #' `by_vars` as this will help when an aggregating, lagging, or ranking @@ -49,13 +32,6 @@ #' #' *Permitted Values:* A character of `PARAMCD` value #' -#' @param analysis_var Analysis variable. -#' -#' @param summary_fun Function that takes as an input the `analysis_var` and -#' performs the calculation. -#' This can include built-in functions as well as user defined functions, -#' for example `mean` or `function(x) mean(x, na.rm = TRUE)`. -#' #' @param by_vars Grouping variables #' #' For each group defined by `by_vars` an observation is added to the output @@ -164,19 +140,9 @@ derive_param_exposure <- function(dataset = NULL, dataset_add, by_vars, input_code, - analysis_var, - summary_fun, - filter = NULL, filter_add = NULL, set_values_to = NULL) { by_vars <- assert_vars(by_vars) - if (!missing(analysis_var) || !missing(summary_fun)) { - deprecate_stop( - "1.1.0", - I("derive_param_exposure(anaylsis_var = , summary_fun = )"), - "derive_param_exposure(set_values_to = )" - ) - } dtm <- c("ASTDTM", "AENDTM") %in% colnames(dataset) dt <- c("ASTDT", "AENDT") %in% colnames(dataset) @@ -203,14 +169,6 @@ derive_param_exposure <- function(dataset = NULL, required_vars = expr_c(by_vars, exprs(PARAMCD), dates) ) - if (!missing(filter)) { - deprecate_stop( - "1.1.0", - I("derive_param_exposure(filter = )"), - "derive_param_exposure(filter_add = )" - ) - filter_add <- assert_filter_cond(enexpr(filter), optional = TRUE) - } filter_add <- assert_filter_cond(enexpr(filter_add), optional = TRUE) assert_varval_list(set_values_to, required_elements = "PARAMCD") assert_param_does_not_exist(dataset, set_values_to$PARAMCD) diff --git a/R/derive_summary_records.R b/R/derive_summary_records.R index c7cf09291..6585abcd9 100644 --- a/R/derive_summary_records.R +++ b/R/derive_summary_records.R @@ -33,22 +33,6 @@ #' #' `r roxygen_param_by_vars()` #' -#' @param filter -#' -#' `r lifecycle::badge("deprecated")` Please use `filter_add` instead. -#' -#' Filter condition as logical expression to apply during -#' summary calculation. By default, filtering expressions are computed within -#' `by_vars` as this will help when an aggregating, lagging, or ranking -#' function is involved. -#' -#' For example, -#' -#' + `filter = (AVAL > mean(AVAL, na.rm = TRUE))` will filter all `AVAL` -#' values greater than mean of `AVAL` with in `by_vars`. -#' + `filter = (dplyr::n() > 2)` will filter n count of `by_vars` greater -#' than 2. -#' #' @param filter_add Filter condition as logical expression to apply during #' summary calculation. By default, filtering expressions are computed within #' `by_vars` as this will help when an aggregating, lagging, or ranking @@ -89,8 +73,6 @@ #' *Permitted Values*: named list of expressions, e.g., #' `exprs(AVAL = -9999)` #' -#' @inheritParams get_summary_records -#' #' @return A data frame with derived records appended to original dataset. #' #' @family der_prm_bds_findings @@ -191,10 +173,7 @@ derive_summary_records <- function(dataset = NULL, dataset_add, dataset_ref = NULL, by_vars, - filter = NULL, filter_add = NULL, - analysis_var, - summary_fun, set_values_to, missing_values = NULL) { assert_vars(by_vars) @@ -209,25 +188,6 @@ derive_summary_records <- function(dataset = NULL, assert_varval_list(set_values_to) assert_expr_list(missing_values, named = TRUE, optional = TRUE) - if (!missing(analysis_var) || !missing(summary_fun)) { - deprecate_stop( - "1.1.0", - I("derive_summary_records(anaylsis_var = , summary_fun = )"), - "derive_summary_records(set_values_to = )" - ) - analysis_var <- assert_symbol(enexpr(analysis_var)) - assert_s3_class(summary_fun, "function") - set_values_to <- exprs(!!analysis_var := {{ summary_fun }}(!!analysis_var), !!!set_values_to) - } - - if (!missing(filter)) { - deprecate_stop( - "1.1.0", - I("derive_summary_records(filter = )"), - "derive_summary_records(filter_add = )" - ) - filter_add <- assert_filter_cond(enexpr(filter), optional = TRUE) - } filter_add <- assert_filter_cond(enexpr(filter_add), optional = TRUE) summary_records <- dataset_add %>% diff --git a/R/derive_var_joined_exist_flag.R b/R/derive_var_joined_exist_flag.R index 77cc28a95..2cbaa57eb 100644 --- a/R/derive_var_joined_exist_flag.R +++ b/R/derive_var_joined_exist_flag.R @@ -56,21 +56,6 @@ #' #' The `*.join` variables are not included in the output dataset. #' -#' @param first_cond Condition for selecting range of data -#' -#' `r lifecycle::badge("deprecated")` -#' -#' This argument is *deprecated*, please use `first_cond_upper` instead. -#' -#' If this argument is specified, the other observations are restricted up to -#' the first observation where the specified condition is fulfilled. If the -#' condition is not fulfilled for any of the other observations, no -#' observations are considered, i.e., the observation is not flagged. -#' -#' This parameter should be specified if `filter_join` contains summary -#' functions which should not apply to all observations but only up to the -#' confirmation assessment. For an example see the third example below. -#' #' @param first_cond_lower Condition for selecting range of data (before) #' #' If this argument is specified, the other observations are restricted from @@ -107,21 +92,6 @@ #' confirmation observation the response is "CR" or "NE" and there is at most #' one "NE". #' -#' @param filter Condition for selecting observations -#' -#' `r lifecycle::badge("deprecated")` -#' -#' This argument is *deprecated*, please use `filter_join` instead. -#' -#' The filter is applied to the joined dataset for flagging the confirmed -#' observations. The condition can include summary functions. The joined -#' dataset is grouped by the original observations. I.e., the summary function -#' are applied to all observations up to the confirmation observation. For -#' example, `filter = AVALC == "CR" & all(AVALC.join %in% c("CR", "NE")) & -#' count_vals(var = AVALC.join, val = "NE") <= 1` selects observations with -#' response "CR" and for all observations up to the confirmation observation -#' the response is "CR" or "NE" and there is at most one "NE". -#' #' @param check_type Check uniqueness? #' #' If `"warning"` or `"error"` is specified, the specified message is issued @@ -444,10 +414,8 @@ derive_var_joined_exist_flag <- function(dataset, tmp_obs_nr_var = NULL, join_vars, join_type, - first_cond = NULL, first_cond_lower = NULL, first_cond_upper = NULL, - filter = NULL, filter_add = NULL, filter_join, true_value = "Y", @@ -457,24 +425,8 @@ derive_var_joined_exist_flag <- function(dataset, tmp_obs_nr_var <- assert_symbol(enexpr(tmp_obs_nr_var), optional = TRUE) first_cond_lower <- assert_filter_cond(enexpr(first_cond_lower), optional = TRUE) first_cond_upper <- assert_filter_cond(enexpr(first_cond_upper), optional = TRUE) - if (!missing(first_cond)) { - deprecate_stop( - "1.1.0", - "derive_var_joined_exist_flag(first_cond=)", - "derive_var_joined_exist_flag(first_cond_upper=)" - ) - first_cond_upper <- assert_filter_cond(enexpr(first_cond), optional = TRUE) - } filter_add <- assert_filter_cond(enexpr(filter_add), optional = TRUE) filter_join <- assert_filter_cond(enexpr(filter_join)) - if (!missing(filter)) { - deprecate_stop( - "1.1.0", - "derive_var_joined_exist_flag(filter=)", - "derive_var_joined_exist_flag(filter_join=)" - ) - filter_join <- assert_filter_cond(enexpr(filter)) - } assert_data_frame(dataset) tmp_obs_nr <- get_new_tmp_var(dataset, prefix = "tmp_obs_nr_") diff --git a/R/event.R b/R/event.R index 96517f08d..d548df2a1 100644 --- a/R/event.R +++ b/R/event.R @@ -149,19 +149,6 @@ event <- function(dataset_name = NULL, #' #' *Permitted Values:* `"before"`, `"after"`, `"all"` #' -#' @param first_cond Condition for selecting range of data -#' -#' `r lifecycle::badge("deprecated")` -#' -#' This argument is *deprecated*, please use `first_cond_upper` instead. -#' -#' If this argument is specified, the other observations are restricted up to -#' the first observation where the specified condition is fulfilled. If the -#' condition is not fulfilled for any of the subsequent observations, all -#' observations are removed. -#' -#' *Permitted Values*: an unquoted condition -#' #' @param first_cond_lower Condition for selecting range of data (before) #' #' If this argument is specified, the other observations are restricted from @@ -348,22 +335,12 @@ event_joined <- function(dataset_name = NULL, order = NULL, join_vars, join_type, - first_cond = NULL, first_cond_lower = NULL, first_cond_upper = NULL, set_values_to = NULL, keep_source_vars = NULL, description = NULL) { - if (!missing(first_cond)) { - deprecate_stop( - "1.1.0", - "event_joined(first_cond=)", - "event_joined(first_cond_upper=)" - ) - first_cond_upper <- assert_filter_cond(enexpr(first_cond), optional = TRUE) - } else { - first_cond_upper <- assert_filter_cond(enexpr(first_cond_upper), optional = TRUE) - } + first_cond_upper <- assert_filter_cond(enexpr(first_cond_upper), optional = TRUE) out <- list( description = assert_character_scalar(description, optional = TRUE), diff --git a/R/filter_joined.R b/R/filter_joined.R index 6a34e107d..65a8dcb76 100644 --- a/R/filter_joined.R +++ b/R/filter_joined.R @@ -41,17 +41,6 @@ #' #' The `*.join` variables are not included in the output dataset. #' -#' @param first_cond Condition for selecting range of data -#' -#' `r lifecycle::badge("deprecated")` -#' -#' This argument is *deprecated*, please use `first_cond_upper` instead. -#' -#' If this argument is specified, the other observations are restricted up to -#' the first observation where the specified condition is fulfilled. If the -#' condition is not fulfilled for any of the subsequent observations, all -#' observations are removed. -#' #' @param first_cond_lower Condition for selecting range of data (before) #' #' If this argument is specified, the other observations are restricted from @@ -106,23 +95,6 @@ #' The condition can include summary functions. The additional dataset is #' grouped by the by variables (`by_vars`). #' -#' @param filter Condition for selecting observations -#' -#' `r lifecycle::badge("deprecated")` -#' -#' This argument is *deprecated*, please use `filter_join` instead. -#' -#' The filter is applied to the joined dataset for selecting the confirmed -#' observations. The condition can include summary functions. The joined -#' dataset is grouped by the original observations. I.e., the summary function -#' are applied to all observations up to the confirmation observation. For -#' example in the oncology setting when using this function for confirmed best -#' overall response, `filter = AVALC == "CR" & all(AVALC.join %in% c("CR", -#' "NE")) & count_vals(var = AVALC.join, val = "NE") <= 1` selects -#' observations with response "CR" and for all observations up to the -#' confirmation observation the response is "CR" or "NE" and there is at most -#' one "NE". -#' #' @param filter_join Condition for selecting observations #' #' The filter is applied to the joined dataset for selecting the confirmed @@ -444,14 +416,12 @@ filter_joined <- function(dataset, by_vars, join_vars, join_type, - first_cond = NULL, first_cond_lower = NULL, first_cond_upper = NULL, order, tmp_obs_nr_var = NULL, filter_add = NULL, filter_join, - filter = NULL, check_type = "warning") { # Check input parameters assert_vars(by_vars) @@ -464,22 +434,10 @@ filter_joined <- function(dataset, ) first_cond_lower <- assert_filter_cond(enexpr(first_cond_lower), optional = TRUE) first_cond_upper <- assert_filter_cond(enexpr(first_cond_upper), optional = TRUE) - if (!missing(first_cond)) { - deprecate_stop( - "1.1.0", - "filter_joined(first_cond=)", - "filter_joined(first_cond_upper=)" - ) - first_cond_upper <- assert_filter_cond(enexpr(first_cond), optional = TRUE) - } assert_expr_list(order) tmp_obs_nr_var <- assert_symbol(enexpr(tmp_obs_nr_var), optional = TRUE) filter_add <- assert_filter_cond(enexpr(filter_add), optional = TRUE) filter_join <- assert_filter_cond(enexpr(filter_join)) - if (!missing(filter)) { - deprecate_stop("1.1.0", "filter_joined(filter=)", "filter_joined(filter_join=)") - filter_join <- assert_filter_cond(enexpr(filter)) - } check_type <- assert_character_scalar( check_type, diff --git a/man/consolidate_metadata.Rd b/man/consolidate_metadata.Rd index e4695a094..eee4db6fa 100644 --- a/man/consolidate_metadata.Rd +++ b/man/consolidate_metadata.Rd @@ -9,7 +9,6 @@ consolidate_metadata( key_vars, source_var = SOURCE, check_vars = "warning", - check_keys, check_type = "error" ) } @@ -38,16 +37,6 @@ if the variable names differ across the input datasets (\code{datasets}). \emph{Permitted Values}: \code{"none"}, \code{"message"}, \code{"warning"}, \code{"error"}} -\item{check_keys}{Check keys? - -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Please use \code{check_type} instead. - -If \code{"warning"} or \code{"error"} is specified, a message is issued if the key -variables (\code{key_vars}) are not a unique key in all of the input datasets -(\code{datasets}). - -\emph{Permitted Values}: \code{"none"}, \code{"warning"}, \code{"error"}} - \item{check_type}{Check uniqueness? If \code{"warning"} or \code{"error"} is specified, a message is issued if the key diff --git a/man/derive_extreme_event.Rd b/man/derive_extreme_event.Rd index 6ff37cc0e..16e2d8df2 100644 --- a/man/derive_extreme_event.Rd +++ b/man/derive_extreme_event.Rd @@ -12,7 +12,6 @@ derive_extreme_event( order, mode, source_datasets = NULL, - ignore_event_order = NULL, check_type = "warning", set_values_to = NULL, keep_source_vars = exprs(everything()) @@ -74,22 +73,6 @@ event sorting by \code{order}. A named list of datasets is expected. The \code{dataset_name} field of \code{event()} and \code{event_joined()} refers to the dataset provided in the list.} -\item{ignore_event_order}{Ignore event order - -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} - -This argument is \emph{deprecated}. If event order should be ignored, please -specify neither \code{ignore_event_order} nor \code{tmp_event_nr_var}. If the event -order should be considered, don't specify \code{ignore_event_order} but specify -\code{tmp_event_nr_var} and and the specified variable to \code{order}. - -If the argument is set to \code{TRUE}, all events defined by \code{events} are -considered equivalent. If there is more than one observation per by group -the first or last (with respect to \code{mode} and \code{order}) is select without -taking the order of the events into account. - -\emph{Permitted Values:} \code{TRUE}, \code{FALSE}} - \item{check_type}{Check uniqueness? If \code{"warning"} or \code{"error"} is specified, the specified message is issued diff --git a/man/derive_param_exposure.Rd b/man/derive_param_exposure.Rd index a92e2c93c..2906a06c5 100644 --- a/man/derive_param_exposure.Rd +++ b/man/derive_param_exposure.Rd @@ -9,9 +9,6 @@ derive_param_exposure( dataset_add, by_vars, input_code, - analysis_var, - summary_fun, - filter = NULL, filter_add = NULL, set_values_to = NULL ) @@ -44,28 +41,6 @@ summary record. \emph{Permitted Values:} A character of \code{PARAMCD} value} -\item{analysis_var}{Analysis variable.} - -\item{summary_fun}{Function that takes as an input the \code{analysis_var} and -performs the calculation. -This can include built-in functions as well as user defined functions, -for example \code{mean} or \code{function(x) mean(x, na.rm = TRUE)}.} - -\item{filter}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Please use \code{filter_add} instead. - -Filter condition as logical expression to apply during -summary calculation. By default, filtering expressions are computed within -\code{by_vars} as this will help when an aggregating, lagging, or ranking -function is involved. - -For example, -\itemize{ -\item \code{filter = (AVAL > mean(AVAL, na.rm = TRUE))} will filter all \code{AVAL} -values greater than mean of \code{AVAL} with in \code{by_vars}. -\item \code{filter = (dplyr::n() > 2)} will filter n count of \code{by_vars} greater -than 2. -}} - \item{filter_add}{Filter condition as logical expression to apply during summary calculation. By default, filtering expressions are computed within \code{by_vars} as this will help when an aggregating, lagging, or ranking diff --git a/man/derive_summary_records.Rd b/man/derive_summary_records.Rd index 9d955d62d..674059abc 100644 --- a/man/derive_summary_records.Rd +++ b/man/derive_summary_records.Rd @@ -9,10 +9,7 @@ derive_summary_records( dataset_add, dataset_ref = NULL, by_vars, - filter = NULL, filter_add = NULL, - analysis_var, - summary_fun, set_values_to, missing_values = NULL ) @@ -43,21 +40,6 @@ groupwise summary and generate summary records for the specified groups. \emph{Permitted Values}: list of variables created by \code{exprs()} e.g. \code{exprs(USUBJID, VISIT)}} -\item{filter}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Please use \code{filter_add} instead. - -Filter condition as logical expression to apply during -summary calculation. By default, filtering expressions are computed within -\code{by_vars} as this will help when an aggregating, lagging, or ranking -function is involved. - -For example, -\itemize{ -\item \code{filter = (AVAL > mean(AVAL, na.rm = TRUE))} will filter all \code{AVAL} -values greater than mean of \code{AVAL} with in \code{by_vars}. -\item \code{filter = (dplyr::n() > 2)} will filter n count of \code{by_vars} greater -than 2. -}} - \item{filter_add}{Filter condition as logical expression to apply during summary calculation. By default, filtering expressions are computed within \code{by_vars} as this will help when an aggregating, lagging, or ranking @@ -71,18 +53,6 @@ values greater than mean of \code{AVAL} with in \code{by_vars}. than 2. }} -\item{analysis_var}{Analysis variable. - -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Please use \code{set_values_to} instead.} - -\item{summary_fun}{Function that takes as an input the \code{analysis_var} and -performs the calculation. - -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Please use \code{set_values_to} instead. - -This can include built-in functions as well as user defined functions, -for example \code{mean} or \code{function(x) mean(x, na.rm = TRUE)}.} - \item{set_values_to}{Variables to be set The specified variables are set to the specified values for the new diff --git a/man/derive_var_joined_exist_flag.Rd b/man/derive_var_joined_exist_flag.Rd index 68afcaf1d..1a3d9da15 100644 --- a/man/derive_var_joined_exist_flag.Rd +++ b/man/derive_var_joined_exist_flag.Rd @@ -13,10 +13,8 @@ derive_var_joined_exist_flag( tmp_obs_nr_var = NULL, join_vars, join_type, - first_cond = NULL, first_cond_lower = NULL, first_cond_upper = NULL, - filter = NULL, filter_add = NULL, filter_join, true_value = "Y", @@ -86,21 +84,6 @@ after seven days before a COVID AE. Thus \code{join_type = "all"} could be used. \emph{Permitted Values:} \code{"before"}, \code{"after"}, \code{"all"}} -\item{first_cond}{Condition for selecting range of data - -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} - -This argument is \emph{deprecated}, please use \code{first_cond_upper} instead. - -If this argument is specified, the other observations are restricted up to -the first observation where the specified condition is fulfilled. If the -condition is not fulfilled for any of the other observations, no -observations are considered, i.e., the observation is not flagged. - -This parameter should be specified if \code{filter_join} contains summary -functions which should not apply to all observations but only up to the -confirmation assessment. For an example see the third example below.} - \item{first_cond_lower}{Condition for selecting range of data (before) If this argument is specified, the other observations are restricted from @@ -125,20 +108,6 @@ This parameter should be specified if \code{filter_join} contains summary functions which should not apply to all observations but only up to the confirmation assessment. For an example see the third example below.} -\item{filter}{Condition for selecting observations - -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} - -This argument is \emph{deprecated}, please use \code{filter_join} instead. - -The filter is applied to the joined dataset for flagging the confirmed -observations. The condition can include summary functions. The joined -dataset is grouped by the original observations. I.e., the summary function -are applied to all observations up to the confirmation observation. For -example, \code{filter = AVALC == "CR" & all(AVALC.join \%in\% c("CR", "NE")) & count_vals(var = AVALC.join, val = "NE") <= 1} selects observations with -response "CR" and for all observations up to the confirmation observation -the response is "CR" or "NE" and there is at most one "NE".} - \item{filter_add}{Filter for additional dataset (\code{dataset_add}) Only observations from \code{dataset_add} fulfilling the specified condition are diff --git a/man/derive_var_merged_summary.Rd b/man/derive_var_merged_summary.Rd index fd50515c2..e5ce37aa4 100644 --- a/man/derive_var_merged_summary.Rd +++ b/man/derive_var_merged_summary.Rd @@ -9,11 +9,8 @@ derive_var_merged_summary( dataset_add, by_vars, new_vars = NULL, - new_var, filter_add = NULL, - missing_values = NULL, - analysis_var, - summary_fun + missing_values = NULL ) } \arguments{ @@ -55,13 +52,6 @@ For example: ) }\if{html}{\out{}}} -\item{new_var}{Variable to add - -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Please use \code{new_vars} instead. - -The specified variable is added to the input dataset (\code{dataset}) and set to -the summarized values.} - \item{filter_add}{Filter for additional dataset (\code{dataset_add}) Only observations fulfilling the specified condition are taken into account @@ -79,21 +69,6 @@ specified for \code{new_vars} can be specified for \code{missing_values}. \emph{Permitted Values}: named list of expressions, e.g., \code{exprs(BASEC = "MISSING", BASE = -1)}} - -\item{analysis_var}{Analysis variable - -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Please use \code{new_vars} instead. - -The values of the specified variable are summarized by the function -specified for \code{summary_fun}.} - -\item{summary_fun}{Summary function - -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Please use \code{new_vars} instead. - -The specified function that takes as input \code{analysis_var} and performs the -calculation. This can include built-in functions as well as user defined -functions, for example \code{mean} or \code{function(x) mean(x, na.rm = TRUE)}.} } \value{ The output dataset contains all observations and variables of the diff --git a/man/derive_vars_merged.Rd b/man/derive_vars_merged.Rd index 12f1e2c67..7856510b2 100644 --- a/man/derive_vars_merged.Rd +++ b/man/derive_vars_merged.Rd @@ -13,7 +13,6 @@ derive_vars_merged( new_vars = NULL, filter_add = NULL, mode = NULL, - match_flag, exist_flag = NULL, true_value = "Y", false_value = NA_character_, @@ -99,17 +98,6 @@ If the \code{order} argument is not specified, the \code{mode} argument is ignor \emph{Permitted Values}: \code{"first"}, \code{"last"}, \code{NULL}} -\item{match_flag}{Match flag - -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Please use \code{exist_flag} instead. - -If the argument is specified (e.g., \code{match_flag = FLAG}), the specified -variable (e.g., \code{FLAG}) is added to the input dataset. This variable will -be \code{TRUE} for all selected records from \code{dataset_add} which are merged into -the input dataset, and \code{NA} otherwise. - -\emph{Permitted Values}: Variable name} - \item{exist_flag}{Exist flag If the argument is specified (e.g., \code{exist_flag = FLAG}), the specified diff --git a/man/event_joined.Rd b/man/event_joined.Rd index c01958b8f..a64017130 100644 --- a/man/event_joined.Rd +++ b/man/event_joined.Rd @@ -10,7 +10,6 @@ event_joined( order = NULL, join_vars, join_type, - first_cond = NULL, first_cond_lower = NULL, first_cond_upper = NULL, set_values_to = NULL, @@ -66,19 +65,6 @@ kept. \emph{Permitted Values:} \code{"before"}, \code{"after"}, \code{"all"}} -\item{first_cond}{Condition for selecting range of data - -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} - -This argument is \emph{deprecated}, please use \code{first_cond_upper} instead. - -If this argument is specified, the other observations are restricted up to -the first observation where the specified condition is fulfilled. If the -condition is not fulfilled for any of the subsequent observations, all -observations are removed. - -\emph{Permitted Values}: an unquoted condition} - \item{first_cond_lower}{Condition for selecting range of data (before) If this argument is specified, the other observations are restricted from diff --git a/man/filter_joined.Rd b/man/filter_joined.Rd index 13cdce516..1182b86e8 100644 --- a/man/filter_joined.Rd +++ b/man/filter_joined.Rd @@ -10,14 +10,12 @@ filter_joined( by_vars, join_vars, join_type, - first_cond = NULL, first_cond_lower = NULL, first_cond_upper = NULL, order, tmp_obs_nr_var = NULL, filter_add = NULL, filter_join, - filter = NULL, check_type = "warning" ) } @@ -63,17 +61,6 @@ after seven days before a COVID AE. Thus \code{join_type = "all"} could be used. \emph{Permitted Values:} \code{"before"}, \code{"after"}, \code{"all"}} -\item{first_cond}{Condition for selecting range of data - -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} - -This argument is \emph{deprecated}, please use \code{first_cond_upper} instead. - -If this argument is specified, the other observations are restricted up to -the first observation where the specified condition is fulfilled. If the -condition is not fulfilled for any of the subsequent observations, all -observations are removed.} - \item{first_cond_lower}{Condition for selecting range of data (before) If this argument is specified, the other observations are restricted from @@ -139,22 +126,6 @@ for confirmed best overall response, \code{filter_join = AVALC == "CR" & all(AV observations up to the confirmation observation the response is "CR" or "NE" and there is at most one "NE".} -\item{filter}{Condition for selecting observations - -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} - -This argument is \emph{deprecated}, please use \code{filter_join} instead. - -The filter is applied to the joined dataset for selecting the confirmed -observations. The condition can include summary functions. The joined -dataset is grouped by the original observations. I.e., the summary function -are applied to all observations up to the confirmation observation. For -example in the oncology setting when using this function for confirmed best -overall response, \code{filter = AVALC == "CR" & all(AVALC.join \%in\% c("CR", "NE")) & count_vals(var = AVALC.join, val = "NE") <= 1} selects -observations with response "CR" and for all observations up to the -confirmation observation the response is "CR" or "NE" and there is at most -one "NE".} - \item{check_type}{Check uniqueness? If \code{"warning"} or \code{"error"} is specified, the specified message is issued diff --git a/tests/testthat/test-consolidate_metadata.R b/tests/testthat/test-consolidate_metadata.R index 7333aced5..af33ac37b 100644 --- a/tests/testthat/test-consolidate_metadata.R +++ b/tests/testthat/test-consolidate_metadata.R @@ -60,34 +60,7 @@ test_that("consolidate_metadata Test 2: error if key vars are not unique", { ) }) - -## Test 3: check_keys deprecation test ---- -test_that("consolidate_metadata Test 3: check_keys deprecation test", { - glob <- tibble::tribble( - ~id, ~val, - 1, "glob_val_1a", - 1, "glob_val_1b", - 2, "glob_val_2" - ) - stud <- tibble::tribble( - ~id, ~val, - 3, "stud_val_3" - ) - - expect_error( - consolidate_metadata( - datasets = list( - global = glob, - study = stud - ), - key_vars = exprs(id), - check_keys = "error" - ), - class = "lifecycle_error_deprecated" - ) -}) - -## Test 4: warn if variables differ ---- +## Test 3: warn if variables differ ---- test_that("consolidate_metadata Test 4: warn if variables differ", { glob <- tibble::tribble( ~id, ~val, diff --git a/tests/testthat/test-derive_extreme_event.R b/tests/testthat/test-derive_extreme_event.R index 3016de8e2..3bddf8402 100644 --- a/tests/testthat/test-derive_extreme_event.R +++ b/tests/testthat/test-derive_extreme_event.R @@ -647,89 +647,7 @@ test_that("derive_extreme_event Test 8: error if source dataset not available", ) }) -## Test 9: deprecation of ignore_event_order ---- -test_that("derive_extreme_event Test 9: deprecation of ignore_event_order", { - adrs <- tibble::tribble( - ~USUBJID, ~AVISITN, ~AVALC, - "1", 1, "PR", - "1", 2, "CR", - "1", 3, "CR" - ) %>% - mutate(PARAMCD = "OVR") - - expect_error( - derive_extreme_event( - adrs, - by_vars = exprs(USUBJID), - order = exprs(AVISITN), - mode = "first", - events = list( - event_joined( - join_vars = exprs(AVALC), - join_type = "after", - first_cond_upper = AVALC.join == "CR", - condition = AVALC == "CR", - set_values_to = exprs(AVALC = "Y") - ), - event_joined( - join_vars = exprs(AVALC), - join_type = "after", - first_cond_upper = AVALC.join %in% c("CR", "PR"), - condition = AVALC == "PR", - set_values_to = exprs(AVALC = "Y") - ) - ), - ignore_event_order = TRUE, - set_values_to = exprs( - PARAMCD = "CRSP" - ) - ), - class = "lifecycle_error_deprecated" - ) -}) - -## Test 10: deprecation of ignore_event_order ---- -test_that("derive_extreme_event Test 10: deprecation of ignore_event_order", { - adrs <- tibble::tribble( - ~USUBJID, ~AVISITN, ~AVALC, - "1", 1, "PR", - "1", 2, "CR", - "1", 3, "CR" - ) %>% - mutate(PARAMCD = "OVR") - - expect_error( - derive_extreme_event( - adrs, - by_vars = exprs(USUBJID), - order = exprs(AVISITN), - mode = "first", - events = list( - event_joined( - join_vars = exprs(AVALC), - join_type = "after", - first_cond_upper = AVALC.join == "CR", - condition = AVALC == "CR", - set_values_to = exprs(AVALC = "Y") - ), - event_joined( - join_vars = exprs(AVALC), - join_type = "after", - first_cond_upper = AVALC.join %in% c("CR", "PR"), - condition = AVALC == "PR", - set_values_to = exprs(AVALC = "Y") - ) - ), - ignore_event_order = FALSE, - set_values_to = exprs( - PARAMCD = "CRSP" - ) - ), - class = "lifecycle_error_deprecated" - ) -}) - -## Test 11: test for duplicates: one warning ---- +## Test 9: test for duplicates: one warning ---- test_that("derive_extreme_event Test 11: test for duplicates: one warning", { ad1 <- tribble( ~USUBJID, ~AVALC, ~ADY, ~ASEQ, @@ -789,7 +707,7 @@ test_that("derive_extreme_event Test 11: test for duplicates: one warning", { }) -## Test 12: test for duplicates: with error ---- +## Test 10: test for duplicates: with error ---- test_that("derive_extreme_event Test 12: test for duplicates: with error", { ad1 <- tribble( ~USUBJID, ~AVALC, ~ADY, ~ASEQ, diff --git a/tests/testthat/test-derive_merged.R b/tests/testthat/test-derive_merged.R index bf29a9aee..3ca807316 100644 --- a/tests/testthat/test-derive_merged.R +++ b/tests/testthat/test-derive_merged.R @@ -348,25 +348,9 @@ test_that("derive_vars_merged Test 15: error if not unique, no order, check_type ) }) -# ## Test 16: deprecation messaging for match_flag ---- -## Test 16: deprecation messaging for match_flag ---- -test_that("derive_vars_merged Test 16: deprecation messaging for match_flag", { - expect_error( - derive_vars_merged( - adsl, - dataset_add = advs, - order = exprs(AVAL), - by_vars = exprs(STUDYID, USUBJID), - new_vars = exprs(WEIGHTBL = AVAL), - mode = "last", - match_flag = matched - ), - class = "lifecycle_error_deprecated" - ) -}) # derive_var_merged_exist_flag ---- -## Test 17: merge existence flag ---- +## Test 16: merge existence flag ---- test_that("derive_var_merged_exist_flag Test 17: merge existence flag", { actual <- derive_var_merged_exist_flag( adsl, @@ -384,7 +368,7 @@ test_that("derive_var_merged_exist_flag Test 17: merge existence flag", { ) }) -## Test 18: by_vars with rename ---- +## Test 17: by_vars with rename ---- test_that("derive_var_merged_exist_flag Test 18: by_vars with rename", { actual <- derive_var_merged_exist_flag( adsl, @@ -406,7 +390,7 @@ test_that("derive_var_merged_exist_flag Test 18: by_vars with rename", { }) # derive_vars_merged_lookup ---- -## Test 19: merge lookup table ---- +## Test 18: merge lookup table ---- test_that("derive_vars_merged_lookup Test 19: merge lookup table", { param_lookup <- tibble::tribble( ~VSTESTCD, ~VSTEST, ~PARAMCD, ~DESCRIPTION, @@ -443,7 +427,7 @@ test_that("derive_vars_merged_lookup Test 19: merge lookup table", { ## the lookup table -## Test 20: all by_vars have records in the lookup table ---- +## Test 19: all by_vars have records in the lookup table ---- test_that("derive_vars_merged_lookup Test 20: all by_vars have records in the lookup table", { param_lookup <- tibble::tribble( ~VSTESTCD, ~VSTEST, ~PARAMCD, ~DESCRIPTION, @@ -479,7 +463,7 @@ test_that("derive_vars_merged_lookup Test 20: all by_vars have records in the l ) }) -## Test 21: by_vars with rename ---- +## Test 20: by_vars with rename ---- test_that("derive_vars_merged_lookup Test 21: by_vars with rename", { param_lookup <- tibble::tribble( ~TESTCD, ~VSTEST, ~PARAMCD, ~DESCRIPTION, @@ -514,7 +498,7 @@ test_that("derive_vars_merged_lookup Test 21: by_vars with rename", { # get_not_mapped ---- -## Test 22: not all by_vars have records in the lookup table ---- +## Test 21: not all by_vars have records in the lookup table ---- test_that("get_not_mapped Test 22: not all by_vars have records in the lookup table", { param_lookup <- tibble::tribble( ~VSTESTCD, ~VSTEST, ~PARAMCD, ~DESCRIPTION, @@ -552,7 +536,7 @@ test_that("get_not_mapped Test 22: not all by_vars have records in the lookup ta }) # derive_var_merged_summary ---- -## Test 23: dataset == dataset_add, no filter ---- +## Test 22: dataset == dataset_add, no filter ---- test_that("derive_var_merged_summary Test 23: dataset == dataset_add, no filter", { expected <- tibble::tribble( ~AVISIT, ~ASEQ, ~AVAL, ~MEANVIS, @@ -579,7 +563,7 @@ test_that("derive_var_merged_summary Test 23: dataset == dataset_add, no filter" ) }) -## Test 24: dataset != dataset_add, filter ---- +## Test 23: dataset != dataset_add, filter ---- test_that("derive_var_merged_summary Test 24: dataset != dataset_add, filter", { expected <- tibble::tribble( ~USUBJID, ~MEANPBL, @@ -611,7 +595,7 @@ test_that("derive_var_merged_summary Test 24: dataset != dataset_add, filter", { ) }) -## Test 25: by_vars with rename ---- +## Test 24: by_vars with rename ---- test_that("derive_var_merged_summary Test 25: by_vars with rename", { expected <- tibble::tribble( ~AVISIT, ~ASEQ, ~AVAL, ~MEANVIS, @@ -639,35 +623,7 @@ test_that("derive_var_merged_summary Test 25: by_vars with rename", { ) }) -## Test 26: deprecation warning ---- -test_that("derive_var_merged_summary Test 26: deprecation warning", { - expected <- tibble::tribble( - ~AVISIT, ~ASEQ, ~AVAL, ~MEANVIS, - "WEEK 1", 1, 10, 10, - "WEEK 1", 2, NA, 10, - "WEEK 2", 3, NA, NA, - "WEEK 3", 4, 42, 42, - "WEEK 4", 5, 12, 13, - "WEEK 4", 6, 12, 13, - "WEEK 4", 7, 15, 13 - ) - - adbds <- select(expected, -MEANVIS) - - expect_error( - actual <- derive_var_merged_summary( - adbds, - dataset_add = adbds, - by_vars = exprs(AVISIT), - new_var = MEANVIS, - analysis_var = AVAL, - summary_fun = function(x) mean(x, na.rm = TRUE) - ), - class = "lifecycle_error_deprecated" - ) -}) - -## Test 27: merge selected variables with relatioship as 'many-to-one' ---- +## Test 25: merge selected variables with relatioship as 'many-to-one' ---- test_that("derive_var_merged_summary Test 27: merge selected variables with relatioship as 'many-to-one'", { actual <- derive_vars_merged(advs, @@ -686,7 +642,7 @@ test_that("derive_var_merged_summary Test 27: merge selected variables with ) }) -## Test 28: error when relatioship is incorrectly specificed 'one-to-one' ---- +## Test 26: error when relatioship is incorrectly specificed 'one-to-one' ---- test_that("derive_var_merged_summary Test 28: error incorrect 'one-to-one'", { expect_snapshot( derive_vars_merged(advs, @@ -699,7 +655,7 @@ test_that("derive_var_merged_summary Test 28: error incorrect 'one-to-one'", { ) }) -## Test 29: merge selected variables with relatioship as 'one-to-one' ---- +## Test 27: merge selected variables with relatioship as 'one-to-one' ---- test_that("derive_var_merged_summary Test 29: merge sel vars 'one-to-one'", { expect_snapshot( derive_vars_merged(adsl, diff --git a/tests/testthat/test-derive_summary_records.R b/tests/testthat/test-derive_summary_records.R index 4c041159c..1d206a681 100644 --- a/tests/testthat/test-derive_summary_records.R +++ b/tests/testthat/test-derive_summary_records.R @@ -105,42 +105,7 @@ test_that("derive_summary_records Test 3: Errors", { ) }) -## Test 4: deprecation warning for analysis_var and summary_fun ---- -test_that("derive_summary_records Test 4: deprecation warning for analysis_var and summary_fun", { - input <- tibble::tribble( - ~subj, ~visit, ~val, ~seq, - "1", 1, 10, 1, - "1", 1, 14, 2, - "1", 1, 9, 3, - "1", 2, 11, 4, - "2", 2, NA_real_, 1 - ) - - expected_output <- bind_rows( - input, - tibble::tribble( - ~subj, ~visit, ~val, - "1", 1, 11, - "1", 2, 11, - "2", 2, NA_real_ - ) %>% - mutate(type = "AVERAGE") - ) - - expect_error( - actual_output <- input %>% - derive_summary_records( - dataset_add = input, - by_vars = exprs(subj, visit), - analysis_var = val, - summary_fun = mean, - set_values_to = exprs(type = "AVERAGE") - ), - class = "lifecycle_error_deprecated" - ) -}) - -## Test 5: make sure dataset_add works ---- +## Test 4: make sure dataset_add works ---- test_that("derive_summary_records Test 5: make sure dataset_add works", { input <- tibble::tribble( ~subj, ~visit, ~val, ~seq, @@ -179,7 +144,7 @@ test_that("derive_summary_records Test 5: make sure dataset_add works", { ) }) -## Test 6: test missing values ---- +## Test 5: test missing values ---- test_that("derive_summary_records Test 6: test missing values with dataset_ref", { input <- tibble::tribble( ~subj, ~visit, ~val, ~seq, diff --git a/tests/testthat/test-derive_var_joined_exist_flag.R b/tests/testthat/test-derive_var_joined_exist_flag.R index 5bb997ea1..dbb2b4724 100644 --- a/tests/testthat/test-derive_var_joined_exist_flag.R +++ b/tests/testthat/test-derive_var_joined_exist_flag.R @@ -287,58 +287,3 @@ test_that("derive_var_joined_exist_flag Test 6: tmp_obs_nr_var argument works", keys = c("USUBJID", "AVISITN") ) }) - -## Test 7: deprecation of `filter` ---- -test_that("derive_var_joined_exist_flag Test 7: deprecation of `filter`", { - expect_error( - actual <- - derive_var_joined_exist_flag( - data, - dataset_add = data, - new_var = CONFFL, - by_vars = exprs(USUBJID), - join_vars = exprs(AVALC), - join_type = "after", - order = exprs(AVISITN), - filter = AVALC == "PR" & AVALC.join %in% c("CR", "PR") - ), - class = "lifecycle_error_deprecated" - ) -}) - -## Test 8: deprecation of `first_cond` ---- -test_that("derive_var_joined_exist_flag Test 8: deprecation of `first_cond`", { - data <- tibble::tribble( - ~USUBJID, ~AVISITN, ~AVALC, - "1", 1, "PR", - "1", 2, "CR", - "1", 3, "CR", - "1", 4, "SD", - "1", 5, "NE", - "2", 1, "SD", - "2", 2, "PR", - "2", 3, "PD", - "3", 1, "CR", - "4", 1, "CR", - "4", 2, "SD", - "4", 3, "CR", - "4", 4, "CR" - ) - - expect_error( - actual <- - derive_var_joined_exist_flag( - data, - dataset_add = data, - new_var = CONFFL, - by_vars = exprs(USUBJID), - join_vars = exprs(AVALC), - join_type = "after", - first_cond = AVALC == "CR" & - AVALC.join == "CR", - order = exprs(AVISITN), - filter_join = TRUE - ), - class = "lifecycle_error_deprecated" - ) -}) diff --git a/tests/testthat/test-event.R b/tests/testthat/test-event.R index 427d449af..9b2af5c38 100644 --- a/tests/testthat/test-event.R +++ b/tests/testthat/test-event.R @@ -73,36 +73,3 @@ test_that("event Test 1: Cover event$order", { keys = c("USUBJID") ) }) - -# event_joined ---- -## Test 2: deprecation of `first_cond` ---- -test_that("event_joined Test 2: deprecation of `first_cond`", { - new_event <- event_joined( - join_vars = exprs(AVALC, ADT), - join_type = "after", - first_cond_upper = AVALC.join == "CR" & - ADT.join >= ADT + 28, - condition = AVALC == "CR" & - all(AVALC.join %in% c("CR", "NE")) & - count_vals(var = AVALC.join, val = "NE") <= 1, - set_values_to = exprs( - AVALC = "CR" - ) - ) - - expect_error( - old_event <- event_joined( - join_vars = exprs(AVALC, ADT), - join_type = "after", - first_cond = AVALC.join == "CR" & - ADT.join >= ADT + 28, - condition = AVALC == "CR" & - all(AVALC.join %in% c("CR", "NE")) & - count_vals(var = AVALC.join, val = "NE") <= 1, - set_values_to = exprs( - AVALC = "CR" - ) - ), - class = "lifecycle_error_deprecated" - ) -}) diff --git a/tests/testthat/test-filter_joined.R b/tests/testthat/test-filter_joined.R index a73421e06..80832fdd7 100644 --- a/tests/testthat/test-filter_joined.R +++ b/tests/testthat/test-filter_joined.R @@ -137,45 +137,8 @@ test_that("filter_joined Test 4: join_type = 'all'", { ) }) -## Test 5: deprecation of `filter` ---- -test_that("filter_joined Test 5: deprecation of `filter`", { - expect_error( - actual <- - filter_joined( - data, - dataset_add = data, - by_vars = exprs(USUBJID), - join_vars = exprs(AVISITN, AVALC), - join_type = "after", - order = exprs(AVISITN), - filter = AVALC == "PR" & AVALC.join %in% c("CR", "PR") & - AVISITN < AVISITN.join - ), - class = "lifecycle_error_deprecated" - ) -}) - -## Test 6: deprecation of `first_cond` ---- -test_that("filter_joined Test 6: deprecation of `first_cond`", { - expect_error( - actual <- - filter_joined( - data, - dataset_add = data, - by_vars = exprs(USUBJID), - join_vars = exprs(AVALC), - join_type = "after", - first_cond = AVALC == "CR" & - AVALC.join == "CR", - order = exprs(AVISITN), - filter_join = TRUE - ), - class = "lifecycle_error_deprecated" - ) -}) - # min_cond ---- -## Test 7: minimum is derived correctly ---- +## Test 5: minimum is derived correctly ---- test_that("min_cond Test 7: minimum is derived correctly", { data <- tibble::tribble( ~USUBJID, ~AVISITN, ~AVALC, @@ -213,7 +176,7 @@ test_that("min_cond Test 7: minimum is derived correctly", { }) # max_cond ---- -## Test 8: maximum is derived correctly ---- +## Test 6: maximum is derived correctly ---- test_that("max_cond Test 8: maximum is derived correctly", { data <- tibble::tribble( ~USUBJID, ~AVISITN, ~AVALC,