Just to follow up on my own post a bit:

xmelt$year[xmelt$year == "first", drop = TRUE]

will do what you want.  I think because in the subset there are
multiple columns not all of which are factor, the method for '[' being
used is not the factor one that would drop unused levels.  I did not
make that clear at all the first time around (and probably still
butchered it, which some knowledgeable soul may correct me on).  Also
I did get Hmisc installed, but I think dropUnusedLevels() does not
work in this case for a similar reason.

Henrique's solution is, as usual, the shortest :)

Josh

[snip]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to