[R] creating a list of lists

2007-01-07 Thread Paul Boutros
Hello, I'm trying to create a series of randomForest objects, basically in a loop like this: forests - list(); for (level in 1:10) { # do some other things here # create a random forest forest - randomForest( x = x.level, y =

Re: [R] creating a list of lists

2007-01-07 Thread Weiwei Shi
change forests - c(forests, forest); into forests[[level]] - forest On 1/6/07, Paul Boutros [EMAIL PROTECTED] wrote: Hello, I'm trying to create a series of randomForest objects, basically in a loop like this: forests - list(); for (level in 1:10) { # do some other things

Re: [R] creating a list of lists

2007-01-07 Thread Eric Archer
Howabout using 'lapply'? forest - lapply(1:10, function(level) { # do some other things here # create and return a random forest randomForest(x = x.level, y = z.level, ntree = trees) }) # give meaningful names names(forest) - paste(level, 1:10, sep = _) Paul Boutros wrote: Hello, I'm