[R] assign a list using expression?

Skotara nils.skotara at uni-hamburg.de
Mon Jan 12 15:42:57 CET 2009


Dear R-users,

I would like to assign elements to a list in the following manner:
mylist <- list(a = a, b = b, c = c)

To do this I tried
myexpr <- expression(a = a, b = b, c = c)
mylist <- list( eval(myexpr) )

It ends up by overwriting a when b is assigned and b when c is assigned. 
Additionally the element of the list does not have a name.
Could you tell me why this is the case?
Thank you very much in advance!

Best regards,
Nils




More information about the R-help mailing list