[R] -> using eval(parse(text= ... ))

Jon Minton jm540 at york.ac.uk
Sat Feb 17 01:13:54 CET 2007


Hi, 

I'm unsure why I can't use eval(parse(text=...)) to represent the thing I
want to assign a value into.

e.g.

> A <- c("Good")
> B <- c("Bad")
> C <- c()
> X <- c("A", "B", "C")
> eval(parse(text=X[1]))
[1] "Good"
> eval(parse(text=X[2])) -> Z
> Z
[1] "Bad"
> eval(parse(text=X[3])) <- "Ugly"
Error in file(file, "r") : unable to open connection
In addition: Warning message:
cannot open file 'C', reason 'No such file or directory'  

Why the error message?

I've tried looking through the archive for a solution but, perhaps because
I'm not too sure how to phrase this problem, I've not found one...

-- 



17:40



More information about the R-help mailing list