[R] Intersection of more than two groups in one function?

Liaw, Andy andy_liaw at merck.com
Thu May 5 22:21:40 CEST 2005


Here's a brute-force approach:

> "%i%" <- intersect
> x1 <- c(1, 3, 4, 7)
> x2 <- c(3, 7, 8)
> x3 <- c(7, 1)
> x1 %i% x2 %i% x3
[1] 7

Andy

> From: Ken Termiso
> 
> Hi all,
> 
> As far as I can tell, the only canned way to do an intersect 
> between two 
> vectors of ints is the intersect(vec1, vec2) function -- is 
> there another 
> function I'm missing for intersecting more than two vectors??
> 
> TIA,
> Ken
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
> 
>




More information about the R-help mailing list