set functions

Jonathan Rougier J.C.Rougier@durham.ac.uk
Tue, 4 Jan 2000 16:17:33 +0000 (GMT)


On 4 Jan 2000, Peter Dalgaard BSA wrote:

> > "equiv" <- function(x, y) all(c(match(x, y, 0)>0, match(y, x, 0)>0))

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

But I don't think that would be right!

length(setdiff(1:4, 1:5))==0	# is TRUE
equiv(1:4, 1:5)			# clearly FALSE

Jonathan.

Jonathan Rougier                       Science Laboratories
Department of Mathematical Sciences    South Road
University of Durham                   Durham DH1 3LE

"[B]egin upon the precept ... that the things we see are to be 
 weighed in the scale with what we know"  (Meredith, 1879, The Egoist)

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._