[Rd] pmin/pmax issue with ordered factors
Erwan Le Pennec
lepennec at cmap.polytechnique.fr
Wed Nov 30 11:05:43 CET 2016
pmin/pmax used to work with ordered factors but fail now since this
summer when those functions have tried to handle more cases.
A simple way to trigger the issue is:
Levels: 1 < 5 < 6
> pmin(ordered(c(1,5,6)), ordered(c(1,5,6)))
Error in `mostattributes<-`(`*tmp*`, value = attributes(elts[[1L]])) :
adding class "factor" to an invalid object
A simple fix is to explicitly test for the ordered class and use the
internal method in that case as proposed in the attached patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1016 bytes
Desc: not available
More information about the R-devel