Displaying 1 result from an estimated 1 matches for "expressionevaluator".
2013 Jan 28
1
parse/eval and character encoded expressions: How to deal with non-encoding strings?
Hi,
I am intending to save a path-describing character object in a slot of a
class I'm working on. In order to have the option to use "system.file" etc
in such string-saved path definitions, I wrote this
ExpressionEvaluator <- function(x){
x <- tryCatch(
expr=base::parse(text=x),
error = function(e){return(as.expression(x))},
finally=TRUE)
return(x)
}
This produces
> ExpressionEvaluator("system.file(\"INDEX\")")
expression(system.file("INDEX"))
> eval(Express...