孟欣 <lm_mengxin <at> 163.com> writes:

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

Reduce(intersect,  list(v1 = c("a","b","c","d"),
              v2 = c("a","b","e"),
              v3 = c("a","f","g")))

> Many thanks

-- 
Ken Knoblauch
Inserm U846
Stem-cell and Brain Research Institute
Department of Integrative Neurosciences
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.sbri.fr/members/kenneth-knoblauch.html

______________________________________________
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