Concatenate two qenv
objects
concat.Rd
Combine two qenv
objects by simple concatenate their environments and the code.
We recommend to use the join
method to have a stricter control
in case x
and y
contain duplicated bindings and code.
RHS argument content has priority over the LHS one.
Usage
concat(x, y)
# S4 method for qenv,qenv
concat(x, y)
# S4 method for qenv.error,ANY
concat(x, y)
# S4 method for qenv,qenv.error
concat(x, y)
Examples
q1 <- new_qenv(
code = c(iris1 = "iris1 <- iris", mtcars1 = "mtcars1 <- mtcars"),
env = list2env(list(
iris1 = iris,
mtcars1 = mtcars
))
)
q2 <- q1
q1 <- eval_code(q1, "iris2 <- iris")
q2 <- eval_code(q2, "mtcars2 <- mtcars")
qq <- concat(q1, q2)
get_code(qq)
#> [1] "iris1 <- iris" "mtcars1 <- mtcars" "iris2 <- iris"
#> [4] "iris1 <- iris" "mtcars1 <- mtcars" "mtcars2 <- mtcars"