[I hope all of you had some good holidays/vacation!]
My current flabbergaster:
## a dummy factor> size<- rep( c('short', 'long'), 10 )
## take a subset:> subset( size, size!='short')
[1] "long" "long" "long" "long"
"long" "long" "long" "long"
"long" "long"
## take another subset, all elements that are not some value not actually
found:> subset( size, size!='small')
[1] "short" "long" "short" "long"
"short" "long" "short" "long"
"short" "long" "short" "long"
"short" "long" "short" "long"
[17] "short" "long" "short" "long"
## Now order the factor:> size<-ordered( size, levels=c('short', 'long' ) )
## repeat that subset:> subset( size, size!='small')
ordered(0)
Levels: short < long
So it appears to be invalid/illegal/undefined to ask for all elements in an
*ordered* factor that are *not* some value that does *not* occur in that factor.
Whereas it is perfectly legal to do so for the same, unordered factor?!
## however:> size<-ordered( size, levels=c('short', 'long',
'small' ) )
> subset( size, size!='small')
[1] short long short long short long short long short long short long
short long short long short long short long
Levels: short < long < small
I have not seen anything in the manpage for subset nor ordered that suggests
this behaviour.
Can someone explain the use of this peculiarity to me, or is this a bug that
should be (has been) reported?
RenE Bertin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._