[R] assign a list using expression?
nils.skotara at uni-hamburg.de
Mon Jan 12 16:58:30 CET 2009
Thank you Patrick and Gabor!
Sorry, I think I have not explainend it well.
The purpose is as follows:
names <- letters[1:3]
values <- data.frame(a = 1:3, b = 4:6, c = 7:9)
With more complicated objects similar to 'names' and 'values' I wrote
the following line to assign the elements of the list:
mycommand <- parse(text = paste(names, " = values[\"", names, "\"]",
does not do what I want.
list(a = values["a"], b = values["b"], c = values["c"])
I can not tell why...
I try to understand, what expression and eval do. I know that many times
there are other ways to achieve the same goal.
So here, too. But I think there should be a reason why it does not work
More information about the R-help