levels() counter-intuitif? (PR#1693)
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:
> to get at the extremes,
> 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 ...
> 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: email@example.com
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: firstname.lastname@example.org