[R] assign object to list

Christian Bieli christian.bieli at unibas.ch
Fri Jan 20 12:14:00 CET 2006

Dear all

I want to generate a list like this:

a <- data.frame(1:10)
attr(a,'myattribute') <- 'something'
b <- data.frame(11:20)
attr(b,'myattribute') <- 'anything'
mylist <- list(a,b)

Is there a way to place the dataframes into the list giving them the 
attribute at the same time?
I don't want to create all the dataframes in my workspace first. I tried 
it with parentheses {}, but it obviously did not work.

Thanks in advance.

Christian Bieli, project assistant
Institute of Social and Preventive Medicine
University of Basel, Switzerland
Steinengraben 49
CH-4051 Basel
Tel.: +41 61 270 22 12
Fax:  +41 61 270 22 25
christian.bieli at unibas.ch

More information about the R-help mailing list