Skip to content
Prev 69235 / 398506 Next

Intersection of more than two groups in one function?

No, I know of no "canned" way to do it, as it's based on match(), which is
for two vectors only.

A brute force loop to do it is simple, as I suspect you realize. Perhaps a
faster way is to use tabulate() to find values that appear n times (for n
vectors). That is:

## assume your integer vectors are components of a list, mylist.

## warning: not tested
bigvec<-unlist(mylist)
sort(unique(bigvec))[tabulate(bigvec)==length(mylist)]



-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box