levels() counter-intuitif? (PR#1693)

rjvbertin@hotmail.com rjvbertin@hotmail.com
Wed, 19 Jun 2002 18:58:13 +0200 (MET DST)


Suppose I have a factor size with levels "small", "medium" and "large". 
Then, when I subset this factor:
>ss<-size[size!="medium"]
to get at the extremes,
>levels(ss)
....
Levels:  large medium small

The same happens with
>subset( size, size!="medium")

I understand that the resulting factor inherits the possible levels from its 
"parent", but I do not see in what that is useful. Intuitively, I would 
expect that levels(ss) return "small" and "large". For subset(), there might 
be an option to request inheritance of the number of levels.

RenE J.V. Bertin
College de France/LPPA
11, place Marcelin Berthelot
75005 Paris, France

_________________________________________________________________




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