I often find myself (wanting t)o constructing lists or data.frames like so:
#Find files in subdirs ii <- 0 for (ix in id) { ii <- ii + 1 if (ii == 1) { fl <- list(basename(ix) = list.files(ix)) } else { fl <- c(fl, list(basename(ix) = list.files(ix))) } } The above is for list construction. It does not work as the argument name is not accepted. In python this would be legal but I can't find how to modify the name argument in R to make this legal. Furthermore the use of a separate counter is not very elegant. Would there be a better way? Again, in python appending to a list is very easy but seems to be available in R only for vectors not lists? Any help much appreciated! Alex van der Spek ______________________________________________ R-help@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.