Skip to content

Commit

Permalink
Closes # 459 keeping the documentation of the deprecated functions/ar…
Browse files Browse the repository at this point in the history
…guments up to date (#464)

* Closes # 459 keeping the documentation of the deprecated functions/argument up to date

* updating styler
  • Loading branch information
sadchla-codes authored Aug 30, 2024
1 parent 86c007a commit 8d56877
Show file tree
Hide file tree
Showing 14 changed files with 236 additions and 550 deletions.
3 changes: 0 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ export(assert_expr)
export(assert_expr_list)
export(assert_filter_cond)
export(assert_function)
export(assert_function_param)
export(assert_has_variables)
export(assert_integer_scalar)
export(assert_list_element)
export(assert_list_of)
export(assert_logical_scalar)
export(assert_named)
export(assert_named_exprs)
export(assert_numeric_vector)
export(assert_one_to_one)
export(assert_param_does_not_exist)
Expand Down
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

## Breaking Changes

- The following functions are entering the next phase of the deprecation process: (#459)

### Phase 1 (warning)

### Phase 2 (error)

### Phase 3 (removed)
- The argument `quosures` was removed in the functions `vars2chr(quosures)`, `replace_values_by_names(quosures)`, and `get_source_vars(quosures)`
- Removed at v1.0.0 `assert_named_expr()`
- Removed at v1.0.0 `assert_has_variables()`
- Removed at v1.0.0 `assert_function_param()`

## Documentation

## Other
Expand Down
67 changes: 0 additions & 67 deletions R/assertions.R
Original file line number Diff line number Diff line change
Expand Up @@ -1000,51 +1000,6 @@ assert_named <- function(arg, optional = FALSE,
)
}

#' Assert Argument is a Named List of Expressions
#'
#' @description
#' `r lifecycle::badge("deprecated")`
#'
#' This function is *deprecated*, please use `assert_expr_list()` instead.
#'
#' @inheritParams assert_data_frame
#'
#' @keywords deprecated
#' @family deprecated
#'
#' @return
#' The function throws an error if `arg` is not a named `list` of expression or
#' returns the input invisibly otherwise
#'
#' @export
assert_named_exprs <- function(arg, optional = FALSE) {
deprecate_stop("0.5.0", "assert_named_exprs()", "assert_expr_list()")
}

#' Does a Dataset Contain All Required Variables?
#'
#' Checks if a dataset contains all required variables
#'
#' @description
#' `r lifecycle::badge("deprecated")`
#'
#' This function is *deprecated*, please use `assert_data_frame()` instead.
#'
#' @param dataset A `data.frame`
#' @param required_vars A `character` vector of variable names
#'
#'
#' @return The function throws an error if any of the required variables are
#' missing in the input dataset. Otherwise, the dataset is returned invisibly.
#'
#' @export
#'
#' @keywords deprecated
#' @family deprecated
assert_has_variables <- function(dataset, required_vars) {
deprecate_stop("0.5.0", "assert_has_variables()", "assert_data_frame()")
}

#' Is Argument a Function?
#'
#' Checks if the argument is a function and if all expected arguments are
Expand Down Expand Up @@ -1139,28 +1094,6 @@ assert_function <- function(arg,
invisible(arg)
}

#' Assert Argument is a Parameter of a Function
#'
#' @description
#' `r lifecycle::badge("deprecated")`
#'
#' This function is *deprecated*, please use `assert_function()` instead.
#'
#' @param arg The name of a function passed as a string
#' @param params A character vector of function parameters
#'
#' @keywords deprecated
#' @family deprecated
#'
#' @return
#' The function throws an error if any elements of `params` is not an argument of
#' the function given by `arg`
#'
#' @export
assert_function_param <- function(arg, params) {
deprecate_stop("0.5.0", "assert_function_param()", "assert_function()")
}

#' Asserts That a Parameter is Provided in the Expected Unit
#'
#' Checks if a parameter (`PARAMCD`) in a dataset is provided in the expected
Expand Down
12 changes: 1 addition & 11 deletions R/dev_utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,8 @@ contains_vars <- function(arg) {
#'
#' @param expressions A `list` of expressions created using [`exprs()`]
#'
#' @param quosures *Deprecated*, please use `expressions` instead.
#'
#' @return A character vector
#'
#'
#' @export
#'
#' @keywords dev_utility
Expand All @@ -167,14 +164,7 @@ contains_vars <- function(arg) {
#' library(rlang)
#'
#' vars2chr(exprs(USUBJID, AVAL))
vars2chr <- function(expressions, quosures) {
if (!missing(quosures)) {
deprecate_stop(
"0.10.0",
"vars2chr(quosures = )",
"vars2chr(expressions = )"
)
}
vars2chr <- function(expressions) {
rlang::set_names(
map_chr(expressions, as_string),
names(expressions)
Expand Down
12 changes: 1 addition & 11 deletions R/get.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,12 @@ get_duplicates <- function(x) {
#'
#' @param expressions A list of expressions
#'
#' @param quosures *Deprecated*, please use `expressions` instead.
#'
#'
#' @keywords get
#' @family get
#'
#' @return A list of expressions
#' @export
get_source_vars <- function(expressions, quosures) {
if (!missing(quosures)) {
deprecate_stop(
"0.10.0",
"get_source_vars(quosures = )",
"get_source_vars(expressions = )"
)
}
get_source_vars <- function(expressions) {
assert_varval_list(expressions, optional = TRUE)

source_vars <- expr_c(expressions)[lapply(expr_c(expressions), is.symbol) == TRUE]
Expand Down
12 changes: 1 addition & 11 deletions R/quo.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ expr_c <- function(...) {
#'
#' @param expressions A list of expressions
#'
#' @param quosures *Deprecated*, please use `expressions` instead.
#'
#'
#' @keywords quo
#' @family quo
#'
Expand All @@ -43,14 +40,7 @@ expr_c <- function(...) {
#' @examples
#' library(rlang)
#' replace_values_by_names(exprs(AVAL, ADT = convert_dtc_to_dt(EXSTDTC)))
replace_values_by_names <- function(expressions, quosures) {
if (!missing(quosures)) {
deprecate_stop(
"0.3.0",
"replace_values_by_names(quosures = )",
"replace_values_by_names(expressions = )"
)
}
replace_values_by_names <- function(expressions) {
if (is.null(names(expressions))) {
return(expressions)
}
Expand Down
29 changes: 0 additions & 29 deletions man/assert_function_param.Rd

This file was deleted.

32 changes: 0 additions & 32 deletions man/assert_has_variables.Rd

This file was deleted.

30 changes: 0 additions & 30 deletions man/assert_named_exprs.Rd

This file was deleted.

4 changes: 1 addition & 3 deletions man/get_source_vars.Rd

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

4 changes: 1 addition & 3 deletions man/replace_values_by_names.Rd

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

4 changes: 1 addition & 3 deletions man/vars2chr.Rd

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

Loading

0 comments on commit 8d56877

Please sign in to comment.