Dear list,

Given a list of elements like:
aa <- list(one=c("o", "n", "e"),
               tea=c("t", "e", "a"),
               thre=c("t", "h", "r", "e"))

Is there a function that returns the intersection between all?
Both match() and intersect() only deal with two arguments, but sometimes I 
have more.

Here, it should return "e" (or NA if none of the letters are common).

I have a solution to apply %in% multiple times (here two times, first between 
the first two and then between the result and the third) but... perhaps there 
is a better and quicker way.

Thanks in advance,
Adrian

--
Adrian Dusa
Romanian Social Data Archive
1, Schitu Magureanu Bd
050025 Bucharest sector 5
Romania
Tel./Fax: +40 21 3126618 \
          +40 21 3120210 / int.101

______________________________________________
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