Re: [R] Help with list

2013-09-26 Thread arun
(lapply(Caso,names)))  vec1<- numeric(length(nm)) names(vec1)<- nm  do.call(rbind,lapply(Caso,function(x){ indx<- names(vec1)%in% names(x); vec1[indx]<-x;vec1 }))  #  0  1 2 #9  2 10 0 #13 2  0 4 A.K. - Original Message - From: Sebastian Kruk To: R-help Cc: Sent: Thursday, Septe

Re: [R] Help with list

2013-09-26 Thread Gabor Grothendieck
On Thu, Sep 26, 2013 at 2:02 PM, Sebastian Kruk wrote: > I have a list that gives me the number of occurrences of numbers 1, 2, 3 and > 4. > > > Sometimes a single in a casa just appears 0 and 1, in others only 2, and every > combination you can think of. > > > Eg > > >> Caso [1:2] > $ `9` > > >

[R] Help with list

2013-09-26 Thread Sebastian Kruk
I have a list that gives me the number of occurrences of numbers 1, 2, 3 and 4. Sometimes a single in a casa just appears 0 and 1, in others only 2, and every combination you can think of. Eg > Caso [1:2] $ `9` 0 1 2 10 $ `13` 0 2 2 4 Can I turn it into a matrix consisting of 4 colum