Dear S-News listers:
We have encountered the following inconsistencies in S-Plus's set functions:
>test1<-as.factor(letters[1:5])
> test2<-as.factor(letters[3:8])
> test1
[1] a b c d e
> test2
[1] c d e f g h
## First ...
setdiff(test1,test2)
[1] a b
Levels:
[1] "a" "b" "c" "d" "e"
## This looks sensible. But ...
> intersect(test1,test2)
[1] c d e
Levels (first 5 out of 6):
[1] "c" "d" "e" "f" "g"
> levels(.Last.value)
[1] "c" "d" "e" "f" "g" "h"
### This does not seem correct. Problems with factors again! Worse yet ....
> union(test1,test2)
[1] 1 2 3 4 5 6
## which seems completely incorrect
Perhaps these functions need to be made generic with methods for factors in
order to get correct behavior.
Cheers,
Bert Gunter
Biometrics Research
Merck & Company
PO Box 200, Rahway, NJ 07065-0900
Ph: (732) 594-7765 Fax: 594-1565
"The business of the statistician is to catalyze the scientific learning
process." -- George E.P. Box
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|