evalText {FastUtils} | R Documentation |
evaluates a string as R code, and stops if an error occurs
Description
This function evaluates a string as R code, and stops if an error occurs. This can be useful for evaluating code that is generated dynamically.
Usage
evalText(..., envir = parent.frame())
Arguments
... |
the R code to evaluate as characters. Will be joined when evaluating. |
envir |
the environment in which to evaluate the code. Defaults to the parent frame of the function. |
Value
the result of the evaluation
Examples
# Set names of a vector
x <- 1:3
x <- evalText("setNames(x, c('A', 'B', 'C'))")
x
[Package FastUtils version 0.2.1 Index]