Skip to content

Commit e251952

Browse files
authored
Merge branch 'main' into 211_subset@main
Signed-off-by: Marcin <[email protected]>
2 parents 2971a17 + 622cb09 commit e251952

File tree

5 files changed

+5
-95
lines changed

5 files changed

+5
-95
lines changed

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export(get_env)
1212
export(get_var)
1313
export(get_warnings)
1414
export(join)
15-
export(new_qenv)
1615
export(qenv)
1716
exportClasses(qenv)
1817
exportMethods(show)

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ the length of calls included in `code`.
1111

1212
### Breaking Change
1313

14-
* `qenv` objects should now be created with `qenv()` rather than `new_qenv()`. The new constructor always creates an empty object. `new_qenv` is now deprecated.
14+
* `qenv` objects should now be created with `qenv()` rather than `new_qenv()` (which has been removed). The new constructor always creates an empty object.
1515

1616
### Miscellaneous
1717

R/qenv-constructor.R

Lines changed: 2 additions & 73 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 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()
@@ -27,72 +25,3 @@ qenv <- function() {
2725
lockEnvironment(q_env, bindings = TRUE)
2826
methods::new("qenv", env = q_env)
2927
}
30-
31-
32-
#' @param code `r badge("deprecated")`
33-
#' (`character(1)` or `language`) code to evaluate. Accepts and stores comments also.
34-
#' @param env `r badge("deprecated")` (`environment`)
35-
#' Environment being a result of the `code` evaluation.
36-
#' @param names (`character`) for `x[names]`, names of objects included in `qenv` to subset. Names not present in `qenv`
37-
#' are skipped. For `get_code` `r lifecycle::badge("experimental")` vector of object names to return the code for.
38-
#' For more details see the "Extracting dataset-specific code" section.
39-
#'
40-
#' @examples
41-
#' # create qenv with data and code (deprecated)
42-
#' new_qenv(env = list2env(list(a = 1)), code = quote(a <- 1))
43-
#' new_qenv(env = list2env(list(a = 1)), code = parse(text = "a <- 1", keep.source = TRUE))
44-
#' new_qenv(env = list2env(list(a = 1)), code = "a <- 1")
45-
#'
46-
#' @rdname qenv
47-
#' @aliases new_qenv,environment,expression-method
48-
#' @aliases new_qenv,environment,character-method
49-
#' @aliases new_qenv,environment,language-method
50-
#' @aliases new_qenv,environment,missing-method
51-
#' @aliases new_qenv,missing,missing-method
52-
#'
53-
#' @seealso [`base::within()`], [`get_var()`], [`get_env()`], [`get_warnings()`], [`join()`], [`concat()`]
54-
#'
55-
#' @export
56-
setGeneric("new_qenv", function(env = new.env(parent = parent.env(.GlobalEnv)), code = character()) {
57-
lifecycle::deprecate_warn(when = " 0.5.0", what = "new_qenv()", with = "qenv()", always = TRUE)
58-
standardGeneric("new_qenv")
59-
})
60-
61-
setMethod(
62-
"new_qenv",
63-
signature = c(env = "environment", code = "expression"),
64-
function(env, code) {
65-
new_qenv(env, paste(lang2calls(code), collapse = "\n"))
66-
}
67-
)
68-
69-
setMethod(
70-
"new_qenv",
71-
signature = c(env = "environment", code = "character"),
72-
function(env, code) {
73-
new_env <- rlang::env_clone(env, parent = parent.env(.GlobalEnv))
74-
lockEnvironment(new_env, bindings = TRUE)
75-
if (length(code) > 0) code <- paste(code, collapse = "\n")
76-
id <- sample.int(.Machine$integer.max, size = length(code))
77-
methods::new(
78-
"qenv",
79-
env = new_env, code = code, warnings = rep("", length(code)), messages = rep("", length(code)), id = id
80-
)
81-
}
82-
)
83-
84-
setMethod(
85-
"new_qenv",
86-
signature = c(env = "environment", code = "language"),
87-
function(env, code) {
88-
new_qenv(env = env, code = paste(lang2calls(code), collapse = "\n"))
89-
}
90-
)
91-
92-
setMethod(
93-
"new_qenv",
94-
signature = c(code = "missing", env = "missing"),
95-
function(env, code) {
96-
new_qenv(env = env, code = code)
97-
}
98-
)

_pkgdown.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ reference:
3434
- get_var
3535
- get_warnings
3636
- join
37-
- new_qenv
3837
- qenv
3938
- show,qenv-method
4039
- within.qenv

man/qenv.Rd

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

0 commit comments

Comments
 (0)