Description Usage Arguments Methods Fields Examples
This R6 Class can be used to evaluate R expressions or R strings in a safe environment.
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()
|
... Passed down to create_safe_environment
str A string or expression to evaluate
new_device Whether to open an new graphics device for plots.
See evaluate::evaluate
reset_env Should the user environment be reset?
x A string representing a symbol. Can be a function name or
an infix operator like %>%.
package The package where the symbol comes from.
new() initializes a new evaluator object.
eval() evaluates a string or expression in a safe environment.
replay() uses evaluate::replay() to show the result of the
last evaluate() call.
appendSymbol() extends the safe environment by a function or
operator.
getUserEnv() Returns a tabular representation of the environment
created by the call to $eval()
hasPlot(), hadError() and hadWarning() are flags that can be used to
check whether the expression in eval produced a plot, error or warning.
plot is an active binding that replays the last plot using
grDevices::replayPlot(). In case of a gplot, a ggplot object
is returned.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.