evaluator: Class for safe evaluation

Description Usage Arguments Methods Fields Examples

Description

This R6 Class can be used to evaluate R expressions or R strings in a safe environment.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
evt <- evaluator$new(...)
evt$eval(str, new_device = FALSE, reset_env = TRUE)
evt$replay()
# -------------------------------------------------- #
evt$appendSymbol(x, package)
evt$plot
evt$getUserEnv()
# -------------------------------------------------- #
evt$hasPlot()
evt$hadError()
evt$hadWarning()

Arguments

Methods

Fields

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## create a new object
evt <- evaluator$new()

# evaluate a string and "replay" the result
evt$eval("2 + 2")
evt$replay()

# evaluate an expression. Useful if code spans several lines
evt$eval({
  x <- 2 + 1
  y <- x + 1
  cat(x, y, sep = " ")
})
evt$replay()

GregorDeCillia/kasper documentation built on May 5, 2019, 11:06 p.m.