Skip to content

Bug in order function

1 message · Peter Dalgaard

#
This caught my eye way late and only because of the Apple Mail random-scrollbag bug!

However it is still not fixed in 3.5.0 and as you say, it should be easy.

(Notice that you need to look at the last SO responses, the first 4 are useless...)

The cause of the trouble seems to be that if decreasing is a vector, you get as far as

if (method == "radix" || !is.na(na.last)) return(do.call("order", 
    c(z, na.last = na.last, decreasing = decreasing, method = method)))

and then the c() construct does you in, because of this effect
[[1]]
 [1]  1  2  3  4  5  6  7  8  9 10

$decreasing1
[1] TRUE

$decreasing2
[1] FALSE

This should indeed be easily fixable by wrapping the vector or, maybe better, all arguments other than z in list(). Will fix (in R-devel for now as the urgency doesn't seem that great).

-pd