On Sat, 30 Jul 2016 19:28:42 +0200, Bert Gunter wrote: > Bottom line: No, I dont see any vectorized way to do this. > > However, the following may offer some slight improvement over your approach. > > 1. Why do you need to store these as arrays, which are merely vectors > with a "dim" attribute? > > ## convert to vectors (a list is also a vector): > > dim(x) <- NULL; dim(y) <- NULL
I apologize that my example was not minimal. I have the data stored in an array for other reasons. > 2. ... and use mapply() instead of sapply() (not clear to me *how* > you mean to use sapply() anyway) Sorry, I meant (and I'm using) mapply. > > mapply("%in%",y,x) ## might be slightly faster to use match() directly > > [1] TRUE FALSE TRUE FALSE ## NOT c(T,F,T,F) I'm not sure what you mean by NOT here. You get the same answer as I do, as far as I can see. Thanks for your help! :) Neal ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.