Skip to content

Commit adec6da

Browse files
committed
Deprecate but keep the function and documentation.
1 parent 86aa265 commit adec6da

File tree

3 files changed

+41
-36
lines changed

3 files changed

+41
-36
lines changed

R/qenv-constructor.R

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@
1010
#' `qenv()` instantiates a `qenv` with an empty environment.
1111
#' Any changes must be made by evaluating code in it with `eval_code` or `within`, thereby ensuring reproducibility.
1212
#'
13-
#' `new_qenv()` (`r badge("deprecated")` and not recommended)
14-
#' can instantiate a `qenv` object with data in the environment and code registered.
15-
#'
1613
#' @name qenv
1714
#'
18-
#' @return `qenv` and `new_qenv` return a `qenv` object.
15+
#' @return `qenv` returns a `qenv` object.
1916
#'
17+
#' @seealso [`base::within()`], [`get_var()`], [`get_env()`], [`get_warnings()`], [`join()`], [`concat()`]
2018
#' @examples
2119
#' # create empty qenv
2220
#' qenv()
@@ -29,29 +27,26 @@ qenv <- function() {
2927
}
3028

3129

30+
#' Deprecated function
31+
#'
32+
#' The `new_qenv()` function is deprecated use [`qenv()`].
3233
#' @param code `r badge("deprecated")`
3334
#' (`character(1)` or `language`) code to evaluate. Accepts and stores comments also.
3435
#' @param env `r badge("deprecated")` (`environment`)
3536
#' Environment being a result of the `code` evaluation.
36-
#'
37-
#' @examples
38-
#' # create qenv with data and code (deprecated)
39-
#' new_qenv(env = list2env(list(a = 1)), code = quote(a <- 1))
40-
#' new_qenv(env = list2env(list(a = 1)), code = parse(text = "a <- 1", keep.source = TRUE))
41-
#' new_qenv(env = list2env(list(a = 1)), code = "a <- 1")
42-
#'
43-
#' @rdname qenv
4437
#' @aliases new_qenv,environment,expression-method
4538
#' @aliases new_qenv,environment,character-method
4639
#' @aliases new_qenv,environment,language-method
4740
#' @aliases new_qenv,environment,missing-method
4841
#' @aliases new_qenv,missing,missing-method
49-
#'
50-
#' @seealso [`base::within()`], [`get_var()`], [`get_env()`], [`get_warnings()`], [`join()`], [`concat()`]
42+
#' @return Errors.
43+
#' @seealso [`qenv()`]
5144
#'
5245
#' @export
5346
setGeneric("new_qenv", function(env = new.env(parent = parent.env(.GlobalEnv)), code = character()) {
54-
lifecycle::deprecate_warn(when = " 0.5.0", what = "new_qenv()", with = "qenv()", always = TRUE)
47+
lifecycle::deprecate_stop(when = " 0.5.0",
48+
what = "new_qenv()",
49+
with = "qenv()")
5550
standardGeneric("new_qenv")
5651
})
5752

man/new_qenv.Rd

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/qenv.Rd

Lines changed: 2 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)