3

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?

4

1 回答 1

5

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.

于 2013-05-03T09:14:37.657 回答