Initialize qenv
object with code
and env
. In order to have qenv
reproducible
one needs to initialize with env
which can be reproduced by the code
. Alternatively, one
can create an empty qenv
and evaluate the expressions in this object using eval_code
.
Usage
new_qenv(env = new.env(parent = parent.env(.GlobalEnv)), code = expression())
# S4 method for environment,expression
new_qenv(env = new.env(parent = parent.env(.GlobalEnv)), code = expression())
# S4 method for environment,character
new_qenv(env = new.env(parent = parent.env(.GlobalEnv)), code = expression())
# S4 method for environment,language
new_qenv(env = new.env(parent = parent.env(.GlobalEnv)), code = expression())
# S4 method for missing,missing
new_qenv(env = new.env(parent = parent.env(.GlobalEnv)), code = expression())
Arguments
- env
(
environment
) Environment being a result of thecode
evaluation.- code
(
character(1)
orlanguage
) code to evaluate. Accepts and stores comments also.
Examples
new_qenv(env = list2env(list(a = 1)), code = quote(a <- 1))
#> <environment: 0x55c8e9411528> [L]
#> Parent: <environment: package:checkmate>
#> Bindings:
#> • a: <dbl> [L]
new_qenv(env = list2env(list(a = 1)), code = parse(text = "a <- 1"))
#> <environment: 0x55c8e9ca3850> [L]
#> Parent: <environment: package:checkmate>
#> Bindings:
#> • a: <dbl> [L]
new_qenv(env = list2env(list(a = 1)), code = "a <- 1")
#> <environment: 0x55c8ea46f7e0> [L]
#> Parent: <environment: package:checkmate>
#> Bindings:
#> • a: <dbl> [L]