Skip to content
Prev 181885 / 398513 Next

Odd Behavior Out of setdiff(...) - addition of duplicate entries is not identified

Dear Jason,
On Fri, May 29, 2009 at 2:48 PM, Jason Rupert <jasonkrupert at yahoo.com> wrote:
[snip]
You didn't explicitly say which "improved version" of setdiff() that
you are using, so I can only presume that you are using the
setdiff.data.frame in the prob package.

The behaviour you are observing is expected and matches the
base:::setdiff behaviour in the case of vectors;  cf.

x1 <- c(1:100)
x2 <- c(x1,x1)

setdiff(x1, x2)  # integer(0)
setdiff(x2, x1)  # integer(0)

x3 <- c(1:25)
setdiff(x1, x3)  # 26:100
setdiff(x3, x1)  # integer(0)
The R-help archives are chock full of every possible variant of
questions (and answers) about this, and you haven't said _exactly_
what you are looking for. In the absence of an already posted
solution, please specify exactly what you want and I'll wager an R
Ninja could dispatch it in moments.

Regards,
Jay









***************************************************
G. Jay Kerns, Ph.D.
Associate Professor
Department of Mathematics & Statistics
Youngstown State University
Youngstown, OH 44555-0002 USA
Office: 1035 Cushwa Hall
Phone: (330) 941-3310 Office (voice mail)
-3302 Department
-3170 FAX
E-mail: gkerns at ysu.edu
http://www.cc.ysu.edu/~gjkerns/