Is there a function like parse_R
in the example below that parses a string into the R object it represents? Or more generally, a function that returns whatever the chunk of R code in the string would have returned if you ran it in the current R environment?
> string <- "c(1,2,3,4)"
> vec <- parse_R(string)
> class(vec)
[1] "numeric"
> print(vec)
[1] 1 2 3 4
Maybe eval
can do this? I haven't been able to really figure out how though.