|
1 | 1 | #' Join `qenv` objects |
2 | 2 | #' |
3 | 3 | #' @description |
4 | | -#' `r lifecycle::badge("superseded")` by [c()]. |
5 | | -#' |
6 | 4 | #' Checks and merges two `qenv` objects into one `qenv` object. |
7 | 5 | #' |
| 6 | +#' The `join()` function is superseded by the `c()` function. |
| 7 | +#' |
8 | 8 | #' @details |
9 | 9 | #' Any common code at the start of the `qenvs` is only placed once at the start of the joined `qenv`. |
10 | 10 | #' This allows consistent behavior when joining `qenvs` which share a common ancestor. |
|
19 | 19 | #' x <- eval_code(qenv(), expression(mtcars1 <- mtcars)) |
20 | 20 | #' y <- eval_code(qenv(), expression(mtcars1 <- mtcars['wt'])) |
21 | 21 | #' |
22 | | -#' z <- join(x, y) |
| 22 | +#' z <- c(x, y) |
23 | 23 | #' # Error message will occur |
24 | 24 | #' ``` |
25 | 25 | #' In this example, `mtcars1` object exists in both `x` and `y` objects but the content are not identical. |
|
44 | 44 | #' y, |
45 | 45 | #' "z <- v" |
46 | 46 | #' ) |
47 | | -#' q <- join(x, y) |
48 | | -#' join_q <- join(q, z) |
| 47 | +#' q <- c(x, y) |
| 48 | +#' join_q <- c(q, z) |
49 | 49 | #' # Error message will occur |
50 | 50 | #' |
51 | 51 | #' # Check the order of evaluation based on the id slot |
|
78 | 78 | #' # Error message will occur |
79 | 79 | #' |
80 | 80 | #' # Check the value of temporary variable i in both objects |
81 | | -#' x@.xData$i # Output: 2 |
82 | | -#' y@.xData$i # Output: 3 |
| 81 | +#' x$i # Output: 2 |
| 82 | +#' y$i # Output: 3 |
83 | 83 | #' ``` |
84 | | -#' `join()` fails to provide a proper result because of the temporary variable `i` exists |
| 84 | +#' `c()` and `join()` fails to provide a proper result because of the temporary variable `i` exists |
85 | 85 | #' in both objects but has different value. |
86 | 86 | #' To fix this, we can set `i <- NULL` in the code expression for both objects. |
87 | 87 | #' ```r |
|
104 | 104 | #' # dummy i variable to fix it |
105 | 105 | #' i <- NULL" |
106 | 106 | #' ) |
107 | | -#' q <- join(x,y) |
| 107 | +#' q <- c(x,y) |
108 | 108 | #' ``` |
109 | 109 | #' |
110 | 110 | #' @param x (`qenv`) |
|
119 | 119 | #' q1 <- eval_code(q1, "iris2 <- iris") |
120 | 120 | #' q2 <- eval_code(q2, "mtcars2 <- mtcars") |
121 | 121 | #' qq <- join(q1, q2) |
122 | | -#' get_code(qq) |
| 122 | +#' cat(get_code(qq)) |
123 | 123 | #' |
124 | 124 | #' common_q <- eval_code(q, quote(x <- 1)) |
125 | 125 | #' y_q <- eval_code(common_q, quote(y <- x * 2)) |
126 | 126 | #' z_q <- eval_code(common_q, quote(z <- x * 3)) |
127 | 127 | #' join_q <- join(y_q, z_q) |
128 | 128 | #' # get_code only has "x <- 1" occurring once |
129 | | -#' get_code(join_q) |
| 129 | +#' cat(get_code(join_q)) |
130 | 130 | #' |
131 | 131 | #' @include qenv-errors.R |
132 | 132 | #' |
|
0 commit comments