From prechelt at inf.fu-berlin.de  Thu Mar 29 10:55:40 2007
From: prechelt at inf.fu-berlin.de (prechelt at inf.fu-berlin.de)
Date: Thu, 29 Mar 2007 10:55:40 +0200 (CEST)
Subject: [Rd] 'union' does not handle factors while 'intersect' does
	(PR#9589)
Message-ID: <20070329085540.575AE5AAB4@slim.kubism.ku.dk>

Full_Name: Lutz Prechelt
Version: 2.4.1
OS: Windows XP
Submission from: (NULL) (160.45.111.67)


'union' ignores the fact if its arguments are factors while all other set
operations (intersect, setdiff, setequal, is.element) treat them sensibly.
The manpage does not even mention the term 'factor'.

Example:
f1=factor(c("a","b","b","c"));
f2=factor(c("a","d","d","e"));
print(union(f1,f2));
print(intersect(f1,f2));
print(setdiff(f1,f2));
print(setequal(f1,f2));
print(is.element(f1,f2))

prints

[1] 1 2 3
[1] a
Levels: a d e
[1] b c
Levels: a b c
[1] FALSE
[1]  TRUE FALSE FALSE FALSE



[Rd] 'union' does not handle factors while 'intersect' does (PR#9589)
prechelt at inf.fu-berlin.de