Evaluate code in qenv
Arguments
- object
(
qenv)- code
(
character,languageorexpression) code to evaluate. It is possible to preserve original formatting of thecodeby providing acharacteror anexpressionbeing a result ofparse(keep.source = TRUE).- ...
(
dots) additional arguments passed to future methods.
Details
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.
Examples
# 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)))