Skip to contents

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 the code evaluation.

code

(character(1) or language) code to evaluate. Accepts and stores comments also.

Examples

new_qenv(env = list2env(list(a = 1)), code = quote(a <- 1))
#> <environment: 0x55da23334d90> [L]
#> Parent: <environment: package:checkmate>
#> Bindings:
#>  a: <dbl> [L]
new_qenv(env = list2env(list(a = 1)), code = parse(text = "a <- 1"))
#> <environment: 0x55da21a50048> [L]
#> Parent: <environment: package:checkmate>
#> Bindings:
#>  a: <dbl> [L]
new_qenv(env = list2env(list(a = 1)), code = "a <- 1")
#> <environment: 0x55da22444bb8> [L]
#> Parent: <environment: package:checkmate>
#> Bindings:
#>  a: <dbl> [L]