From p.dalgaard@biostat.ku.dk  Tue Jan  4 16:16:48 2000
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 04 Jan 2000 17:16:48 +0100
Subject: set functions
In-Reply-To: Jonathan Rougier's message of "Tue, 4 Jan 2000 15:47:57 +0000 (GMT)"
References: <Pine.GSO.4.20.0001041528420.20724-100000@laplace>
Message-ID: <x24sctg6bz.fsf@blueberry.kubism.ku.dk>

Jonathan Rougier <J.C.Rougier@durham.ac.uk> writes:

> I wonder if we might also include an "equiv" function along with the other
> set functions (ie "union", "intersect", etc), perhaps along the lines of
> 
> "equiv" <- function(x, y) all(c(match(x, y, 0)>0, match(y, x, 0)>0))
> 
> (which I think might be the quickest implementation).  I use this type of
> function quite frequently: is there some reason why it is not in the base?

length(setdiff(x,y))==0 appears to be about twice as fast....

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


set functions
Peter Dalgaard BSA