Re: [R] Searching elements in list

2011-11-03 Thread David Winsemius
On Nov 3, 2011, at 3:21 PM, mstepano wrote: I forget to mention that the vectors are ordered. I think that one of the possible solutions is to use lapply, i.e., < T %in% lapply(allv, function(x,y) all.equal(x,y),y=somev) [1] TRUE all.equal worked fine when the answer was 'true' but not so

Re: [R] Searching elements in list

2011-11-03 Thread mstepano
I forget to mention that the vectors are ordered. I think that one of the possible solutions is to use lapply, i.e., < T %in% lapply(allv, function(x,y) all.equal(x,y),y=somev) [1] TRUE -- View this message in context: http://r.789695.n4.nabble.com/Searching-elements-in-list-tp3987066p3987487.h

[R] Searching elements in list

2011-11-03 Thread mstepano
Hi all, I have a list ov vectors of enequal lenght and need to check is the given vector in list. > v1<-c(1,2) > v2<-c(1,2,3) > v3<-c(1,3) > allv<-list(v1,v2,v3) > > somev<-c(1,2) > somev%in%allv [1] FALSE FALSE Hence, %in% checks that elements of vector somev are in list. How it is possible to