View source: R/metaProgramming.R
evalText | R Documentation |
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.
evalText(..., envir = parent.frame())
... |
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. |
the result of the evaluation
# Set names of a vector
x <- 1:3
x <- evalText("setNames(x, c('A', 'B', 'C'))")
x
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.