From Torsten.Hothorn@rzmail.uni-erlangen.de  Wed Jun 19 18:41:47 2002
From: Torsten.Hothorn@rzmail.uni-erlangen.de (Torsten Hothorn)
Date: Wed, 19 Jun 2002 19:41:47 +0200 (MEST)
Subject: levels() counter-intuitif? (PR#1693)
In-Reply-To: <200206191658.SAA04763@pubhealth.ku.dk>
Message-ID: <Pine.LNX.4.21.0206191936550.6748-100000@artemis>



> 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

sure, because you didn't change the levels attribute of the factor object
ss. And there is no statement in the documentation that subsetting a
factor object touches the levels attribute. So why is this a bug? If I
remember correctly, there was a dicussion about this issue a few month ago
on this list ...

Torsten

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

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


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