[R] how to force R to evaluate variable?

Duncan Murdoch murdoch at stats.uwo.ca
Tue Sep 22 20:32:12 CEST 2009


On 9/22/2009 2:23 PM, YUPU LIANG wrote:
> Hi,
> 
> I want to construct a list as
> 
> Lst <- list(name_1=object_1, ..., name_m=object_m)
> 
> If name_1 is a variable with value "NAME1", how can I ask R to use  
> "NAME1" instead of 'name_1' as the name of the list element?

Lst <- list(object_1, ..., object_m)
names(Lst) <- c(name_1, ..., name_m)

Duncan Murdoch

> 
> Thanks!
> Yupu
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list