From lepennec at cmap.polytechnique.fr  Wed Nov 30 11:05:43 2016
From: lepennec at cmap.polytechnique.fr (Erwan Le Pennec)
Date: Wed, 30 Nov 2016 11:05:43 +0100
Subject: [Rd] pmin/pmax issue with ordered factors
Message-ID: <b4f9344d-87af-39b3-0b4c-b8c330c91e3c@cmap.polytechnique.fr>

     Dear all,

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:

 > min(ordered(c(1,5,6)))
[1] 1
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.

     Yours,

         Erwan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-patch
Size: 1016 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20161130/71dc22b6/attachment.bin>


[Rd] pmin/pmax issue with ordered factors
Erwan Le Pennec