[R] intersect more than two sets
helprhelp at gmail.com
Tue Apr 24 21:43:03 CEST 2007
I had a similar solution by using frequency but having more codes :(
I also like the "recursive" idea : I initially tried to use rapply,
however, which can only take one-arg function.
On 4/24/07, hadley wickham <h.wickham at gmail.com> wrote:
> 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))
>  "14"
> (not that it's hard to turn that back into a number)
Weiwei Shi, Ph.D
"Did you always know?"
"No, I did not. But I believed..."
More information about the R-help