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 well in my hands when it was 'false'. Also not a good idea to replace the base definition of %in%.

> any( sapply( allv, identical, v1) )
[1] TRUE
> any( sapply( allv, identical, c(3,3,4)) )
[1] FALSE

`%l.in%` <- function(vec,lis) any( sapply( lis, identical, vec) )

Use:
> v1 %l.in% allv
[1] TRUE

--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
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.

Reply via email to