levels() counter-intuitif? (PR#1693)
Torsten Hothorn
Torsten.Hothorn@rzmail.uni-erlangen.de
Wed, 19 Jun 2002 19:41:47 +0200 (MEST)
> 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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._