-
-
Notifications
You must be signed in to change notification settings - Fork 8
Update lifecycle badges #268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b98c0ce
add experimental badge to get_outputs
m7pr f039848
[skip style] [skip vbump] Restyle files
github-actions[bot] fcf46ed
hard deprecate join and get_var
m7pr a3da6e9
[skip style] [skip vbump] Restyle files
github-actions[bot] 2df511d
fix r cmd check
m7pr 3ceb4f7
Merge branch 'lifecycle@main' of https://github.com/insightsengineeri…
m7pr 2c25b4d
change join and get_var to s3
m7pr aa1a5ba
[skip style] [skip vbump] Restyle files
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,152 +1,23 @@ | ||
| #' Join `qenv` objects | ||
| #' | ||
| #' @description | ||
| #' Checks and merges two `qenv` objects into one `qenv` object. | ||
| #' `r lifecycle::badge("deprecated")` | ||
| #' Instead of [join()] use [c()]. | ||
| #' | ||
| #' The `join()` function is superseded by the `c()` function. | ||
| #' | ||
| #' @details | ||
| #' Any common code at the start of the `qenvs` is only placed once at the start of the joined `qenv`. | ||
| #' This allows consistent behavior when joining `qenvs` which share a common ancestor. | ||
| #' See below for an example. | ||
| #' | ||
| #' There are some situations where `join()` cannot be properly performed, such as these three scenarios: | ||
| #' 1. Both `qenv` objects contain an object of the same name but are not identical. | ||
| #' | ||
| #' Example: | ||
| #' | ||
| #' ```r | ||
| #' x <- eval_code(qenv(), expression(mtcars1 <- mtcars)) | ||
| #' y <- eval_code(qenv(), expression(mtcars1 <- mtcars['wt'])) | ||
| #' | ||
| #' z <- c(x, y) | ||
| #' # Error message will occur | ||
| #' ``` | ||
| #' In this example, `mtcars1` object exists in both `x` and `y` objects but the content are not identical. | ||
| #' `mtcars1` in the `x qenv` object has more columns than `mtcars1` in the `y qenv` object (only has one column). | ||
| #' | ||
| #' 2. `join()` will look for identical code elements in both `qenv` objects. | ||
| #' The index position of these code elements must be the same to determine the evaluation order. | ||
| #' Otherwise, `join()` will throw an error message. | ||
| #' | ||
| #' Example: | ||
| #' ```r | ||
| #' common_q <- eval_code(qenv(), expression(v <- 1)) | ||
| #' x <- eval_code( | ||
| #' common_q, | ||
| #' "x <- v" | ||
| #' ) | ||
| #' y <- eval_code( | ||
| #' common_q, | ||
| #' "y <- v" | ||
| #' ) | ||
| #' z <- eval_code( | ||
| #' y, | ||
| #' "z <- v" | ||
| #' ) | ||
| #' q <- c(x, y) | ||
| #' join_q <- c(q, z) | ||
| #' # Error message will occur | ||
| #' | ||
| #' # Check the order of evaluation based on the id slot | ||
| #' ``` | ||
| #' The error occurs because the index position of common code elements in the two objects is not the same. | ||
| #' | ||
| #' 3. The usage of temporary variable in the code expression could cause `join()` to fail. | ||
| #' | ||
| #' Example: | ||
| #' ```r | ||
| #' common_q <- qenv() | ||
| #' x <- eval_code( | ||
| #' common_q, | ||
| #' "x <- numeric(0) | ||
| #' for (i in 1:2) { | ||
| #' x <- c(x, i) | ||
| #' }" | ||
| #' ) | ||
| #' y <- eval_code( | ||
| #' common_q, | ||
| #' "y <- numeric(0) | ||
| #' for (i in 1:3) { | ||
| #' y <- c(y, i) | ||
| #' }" | ||
| #' ) | ||
| #' q <- join(x,y) | ||
| #' # Error message will occur | ||
| #' | ||
| #' # Check the value of temporary variable i in both objects | ||
| #' x$i # Output: 2 | ||
| #' y$i # Output: 3 | ||
| #' ``` | ||
| #' `c()` fails to provide a proper result because of the temporary variable `i` exists | ||
| #' in both objects but has different value. | ||
| #' To fix this, we can set `i <- NULL` in the code expression for both objects. | ||
| #' ```r | ||
| #' common_q <- qenv() | ||
| #' x <- eval_code( | ||
| #' common_q, | ||
| #' "x <- numeric(0) | ||
| #' for (i in 1:2) { | ||
| #' x <- c(x, i) | ||
| #' } | ||
| #' # dummy i variable to fix it | ||
| #' i <- NULL" | ||
| #' ) | ||
| #' y <- eval_code( | ||
| #' common_q, | ||
| #' "y <- numeric(0) | ||
| #' for (i in 1:3) { | ||
| #' y <- c(y, i) | ||
| #' } | ||
| #' # dummy i variable to fix it | ||
| #' i <- NULL" | ||
| #' ) | ||
| #' q <- c(x,y) | ||
| #' ``` | ||
| #' | ||
| #' @param x (`qenv`) | ||
| #' @param y (`qenv`) | ||
| #' | ||
| #' @return `qenv` object. | ||
| #' | ||
| #' @examples | ||
| #' q <- qenv() | ||
| #' q1 <- eval_code(q, expression(iris1 <- iris, mtcars1 <- mtcars)) | ||
| #' q2 <- q1 | ||
| #' q1 <- eval_code(q1, "iris2 <- iris") | ||
| #' q2 <- eval_code(q2, "mtcars2 <- mtcars") | ||
| #' qq <- join(q1, q2) | ||
| #' cat(get_code(qq)) | ||
| #' | ||
| #' common_q <- eval_code(q, quote(x <- 1)) | ||
| #' y_q <- eval_code(common_q, quote(y <- x * 2)) | ||
| #' z_q <- eval_code(common_q, quote(z <- x * 3)) | ||
| #' join_q <- join(y_q, z_q) | ||
| #' # get_code only has "x <- 1" occurring once | ||
| #' cat(get_code(join_q)) | ||
| #' | ||
| #' @include qenv-errors.R | ||
| #' @param ... function is deprecated. | ||
| #' | ||
| #' @name join | ||
| #' @rdname join | ||
| #' @aliases join,qenv,qenv-method | ||
| #' @aliases join,qenv,qenv.error-method | ||
| #' @aliases join,qenv.error,ANY-method | ||
| #' @aliases join,qenv-method | ||
| #' @aliases join,qenv.error-method | ||
| #' | ||
| #' @export | ||
| setGeneric("join", function(x, y) standardGeneric("join")) | ||
|
|
||
| setMethod("join", signature = c("qenv", "qenv"), function(x, y) { | ||
| lifecycle::deprecate_soft("0.6.0", "join()", "c()") | ||
| c(x, y) | ||
| }) | ||
| setGeneric("join", function(...) standardGeneric("join")) | ||
m7pr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| setMethod("join", signature = c("qenv", "qenv.error"), function(x, y) { | ||
| lifecycle::deprecate_soft("0.6.0", "join()", "c()") | ||
| y | ||
| setMethod("join", signature = c("qenv"), function(...) { | ||
| lifecycle::deprecate_stop("0.6.0", "join()", "c()") | ||
| }) | ||
|
|
||
| setMethod("join", signature = c("qenv.error", "ANY"), function(x, y) { | ||
| lifecycle::deprecate_soft("0.6.0", "join()", "c()") | ||
| x | ||
| setMethod("join", signature = c("qenv.error"), function(...) { | ||
| lifecycle::deprecate_stop("0.6.0", "join()", "c()") | ||
| }) | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.