From luke-tierney at uiowa.edu  Mon Apr  9 18:14:39 2018
From: luke-tierney at uiowa.edu (luke-tierney at uiowa.edu)
Date: Mon, 9 Apr 2018 11:14:39 -0500 (CDT)
Subject: [Rd] Part of fastpass in 'sort.list' can make sorting unstable
In-Reply-To: <1729171495.2659788.1523052187300@mail.yahoo.com>
References: <1729171495.2659788.1523052187300.ref@mail.yahoo.com>
 <1729171495.2659788.1523052187300@mail.yahoo.com>
Message-ID: <alpine.LFD.2.21.1804091114110.19756@itasca.stat.uiowa.edu>

Thanks -- fixed in R-devel and R-3-5-branch.

luke

On Fri, 6 Apr 2018, Suharto Anggono Suharto Anggono via R-devel wrote:

> In the code of functions 'order' and 'sort.list' in R 3.5.0 alpha (in https://svn.r-project.org/R/branches/R-3-5-branch/src/library/base/R/sort.R), in "fastpass, take advantage of ALTREP metadata", there is "try the reverse since that's easy too...". If it succeeds, ties are reordered, violating stability of sorting.
>
> Example:
> x <- sort(c(1, 1, 3))
> x  # 1 1 3
> sort.list(x, decreasing=TRUE)  # should be 3 1 2
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:   luke-tierney at uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu



[Rd] Part of fastpass in 'sort.list' can make sorting unstable
luke-tierney at uiowa.edu