[R] subset(..., drop=TRUE) doesn't seem to work.
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Wed Jun 16 18:45:24 CEST 2004
Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:
> No, AFAIK. It was definitely not documented to last November when that
> comment was added to ?subset.
>
> > Bottomline: unless I find the time to submit a patch for '[.data.frame',
> > I'll need to use the more elaborate way of dropping the unused levels?
> >
> > Does "will not drop" imply that it cannot be programmed, should not be
> > programmed, or has not been programmed yet?
>
> It is designed not to. Look at how ?"[.data.frame" documents it. We
> don't want it altered and it would break a lot of code to do so. I think
> the author of those lines was under a misapprension.
Not to say confused... (Brian is tactful enough not to say it was me).
Looking back through my emails from then, I can't say it's all that
surprising. It came from a feature request (the author of which shall
remain anonymous):
...
> noticed that subset.data.frame has drop=FALSE `hard-wired`
> into it, making it problematic in case of factors (depending
> on required behaviour).
and with 3 days to go before 1.8.1, I seem to have just implemented
the suggestion without thinking. (I think we did have a drop.factor at
some point back in the stone age where factors were a primitive data
type, which may have contributed to the confusion.)
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list