On Thu, Feb 02, 2012 at 01:55:07PM +0800, 孟欣 wrote: > v1<-c("a","b","c","d") > v2<-c("a","b","e") > v3<-c("a","f","g") > > > I want to get the intersection of v1,v2,v3,ie "a" > > > How can I do then? > > > What I know is only for 2 vectors via "intersect" function,but don't know how > to deal with multiple vectors.
Hi. Set intersection is an associative operation. So, intersect(intersect(v1, v2), v3) or intersect(v1, intersect(v2, v3)) yield the correct result. Hope this helps. Petr Savicky. ______________________________________________ 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.