Re: [Rd] 'ordered' destroyed to 'factor'

2017-06-18 Thread Joris Meys
struggle to recognize the project I loved in 2000. > > > Gesendet: Freitag, 16. Juni 2017 um 18:31 Uhr > Von: "peter dalgaard" <pda...@gmail.com> > An: "Robert McGehee" <rmcge...@walleyetrading.net> > Cc: "Jens Oehlschlägel" <jens.oehlschla

Re: [Rd] 'ordered' destroyed to 'factor'

2017-06-18 Thread Jens Oehlschlägel
: Freitag, 16. Juni 2017 um 18:31 Uhr Von: "peter dalgaard" <pda...@gmail.com> An: "Robert McGehee" <rmcge...@walleyetrading.net> Cc: "Jens Oehlschlägel" <jens.oehlschlae...@truecluster.com>, "r-devel@r-project.org" <r-devel@r-project.org&g

Re: [Rd] 'ordered' destroyed to 'factor'

2017-06-16 Thread peter dalgaard
> On 16 Jun 2017, at 15:59 , Robert McGehee wrote: > > For instance, what would you expect to get from unlist() if each element of > the list had different levels, or were both ordered, but in a different way, > or if some elements of the list were factors and

Re: [Rd] 'ordered' destroyed to 'factor'

2017-06-16 Thread Joris Meys
This can be traced back to the following line in unlist(): structure(res, levels = lv, names = nm, class = "factor") The Details section of ?unlist states specifically how it treats factors, so this is documented and expected behaviour. This is also the appropriate behaviour. In your case one

Re: [Rd] 'ordered' destroyed to 'factor'

2017-06-16 Thread Robert McGehee
ard to point to any single function and say it is wrong or needs to be changed. My best advice, is to just be careful when combining or aggregating factors. --Robert -Original Message- From: R-devel [mailto:r-devel-boun...@r-project.org] On Behalf Of "Jens Oehlschlägel"

[Rd] 'ordered' destroyed to 'factor'

2017-06-16 Thread Jens Oehlschlägel
Dear all,   I don't know if you consider this a bug or feature, but it breaks reasonable code: 'unlist' and 'sapply' convert 'ordered' to 'factor' even if all levels are equal. Here is a simple example: o <- ordered(letters) o[[1]] lapply(o, min)[[1]]  # ordered factor unlist(lapply(o,