Skip to content

Commit 3fd5e5a

Browse files
committed
add to eval_code docs
1 parent f361e6c commit 3fd5e5a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

R/qenv-eval_code.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
#' Thus, if the `qenv` had been instantiated empty, contents of the environment are always a result of the stored code.
66
#'
77
#' @param object (`qenv`)
8-
#' @param code (`character` or `language`) code to evaluate. If `character`, comments are retained.
8+
#' @param code (`character`, `language` or `expression`) code to evaluate.
9+
#' It is possible to preserve original formatting of the `code` by providing a `character` or an
10+
#' `expression` being a result of `parse(keep.source = TRUE)`.
911
#'
1012
#' @return
1113
#' `eval_code` returns a `qenv` object with `expr` evaluated or `qenv.error` if evaluation fails.
@@ -14,6 +16,7 @@
1416
#' # evaluate code in qenv
1517
#' q <- qenv()
1618
#' q <- eval_code(q, "a <- 1")
19+
#' q <- eval_code(q, "b <- 2L # with comment")
1720
#' q <- eval_code(q, quote(library(checkmate)))
1821
#' q <- eval_code(q, expression(assert_number(a)))
1922
#'

man/qenv.Rd

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)