Evaluate code in qenv
eval_code(object, code, ...)(qenv)
(character, language or expression) code to evaluate.
It is possible to preserve original formatting of the code by providing a character or an
expression being a result of parse(keep.source = TRUE).
(dots) additional arguments passed to future methods.
qenv environment with code/expr evaluated or qenv.error if evaluation fails.
eval_code() evaluates given code in the qenv environment and appends it to the code slot.
Thus, if the qenv had been instantiated empty, contents of the environment are always a result of the stored code.
# evaluate code in qenv
q <- qenv()
q <- eval_code(q, "a <- 1")
q <- eval_code(q, "b <- 2L # with comment")
q <- eval_code(q, quote(library(checkmate)))
q <- eval_code(q, expression(assert_number(a)))