What is the opposite of dput() in R?

eval, r

Solution

You can do this:

eval(parse(text = "c(\"A\",\"B\",\"C\")"))

but it is probably a better idea to fix the output of that function.

Problem

I have a function which for some reason returns a a set of characters in the same way dput() does, i.e as "c("A","B","C")". How do get it back to a character vector. i.e [1] "A" "B" "C" See the following toy example ``` x = c("A", "B", "C") dpx = dput(x) ``` How do I get dpx back to x again?

Original source