[R] intersect more than two sets

hadley wickham h.wickham at gmail.com
Tue Apr 24 21:35:07 CEST 2007


On 4/24/07, Tony Plate <tplate at acm.org> wrote:
> I don't think there's that sort of "apply-reduce" function in R, but for
> this problem, the last line below happens to be a "one-liner":

Only if you have character data though:

> x <- lapply(1:10, function(i) sample(20, 15))
> names(which(table(unlist(x))==10))
[1] "14"

(not that it's hard to turn that back into a number)

Hadley



More information about the R-help mailing list