Re: [R] Subset: data frames and factor levels

From: Ben Bolker <bolker_at_ufl.edu>
Date: Tue, 01 Apr 2008 21:22:16 +0000 (UTC)

Weidong Gu <wgu <at> uab.edu> writes:

>
> Try drop.levels in library gdata.
>

  For what it's worth, adding a drop.levels (default FALSE) to subset is a long-standing wish of mine -- I keep meaning to put together a patch to do this. (This question comes up about once a year on the R help list.) I looked at the drop.levels functionality in gdata (Warnes and Gorjanc are maintainers, this code was written by Rogers and Gorjanc) -- I was hoping it would be a simple drop-in, but although no piece of it is very complicated there are a fair number of pieces (generic definition, methods for data frame, factor, list, etc.).

   I think the best thing would be to (a) move this discussion to R-devel (and/or e-mail with the authors of the stuff in gdata) (b) put together a proposal for migrating drop.levels into R base, along with a drop.levels= argument in subset: I would argue that this would remedy a long-standing "infelicity".

  Ben Bolker



R-help_at_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. Received on Tue 01 Apr 2008 - 22:39:58 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Apr 2008 - 02:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive