Re: [R] intersection on more than two sets

From: jim holtman <jholtman_at_gmail.com>
Date: Thu, 03 Jun 2010 04:20:41 -0400

?Reduce

> x <- function(z) Reduce('union', z)
> x(list(1:3, 4:6))

[1] 1 2 3 4 5 6
> x(list(1:3, 4:6, 3:7))

[1] 1 2 3 4 5 6 7
> x <- function(z) Reduce('intersect', z)
> x(list(1:3, 4:6, 3:7))

integer(0)
> x(list(1:3, 2:6, 3:7))

[1] 3

On Thu, Jun 3, 2010 at 3:59 AM, amir <amir_at_ac.upc.edu> wrote:
> Hi,
>
> I want to do an intersection or union on more than two sets.
> Is there any command to do this?
>
> Regards,
> Amir
>
> ______________________________________________
> R-help_at_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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

______________________________________________
R-help_at_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.
Received on Thu 03 Jun 2010 - 08:23:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Jun 2010 - 09:20:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive