if you have a list of data frames without the attribute and a vector/list of the values for this attributes:
mapply(function(x,y) {attr(x,"names") <- y ; x}, list(data.frame(1:10), data.frame(11:20)), c("something", "anything"), SIMPLIFY=F) Christian Bieli a écrit : >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 > > > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html