Re: [R] Help in splitting ists into sub-lists

2011-04-03 Thread andrija djurovic
Hi: here is one solution. Not so elegant but maybe it will give you some ideas: mylist1<-rep(mylist,c(2,2)) a<-matrix(c(index1,!index1,index2,!index2),ncol=4) mylist2<-list() for (i in 1:4) { mylist2[[i]]<-mylist1[[i]][,a[,i]] } mylist2 Andrija On Sun, Apr 3, 2011 at 6:56 PM, Axel Urbiz wrote

[R] Help in splitting ists into sub-lists

2011-04-03 Thread Axel Urbiz
Dear List, Let's say I have a list whose components are 2 matrices (as exemplified in the "mylist" object below). I'd like to create a list with components being 4 matrices based on an logical index vector. is there a way to simplify what I'm doing to obtain the results in "mylist2"? I'd like some