> x <- c(2,3,4,1,1,1,1,1) > o.x <- order(x) > o.x [1] 4 5 6 7 8 1 2 3 > x[o.x] [1] 1 1 1 1 1 2 3 4 > sort(x) [1] 1 1 1 1 1 2 3 4 > order() is behaving correctly. See ?order for details. > On Jan 30, 2022, at 15:07, Stefan Fleck <stefan.b.fleck using gmail.com> wrote: > > order(c(2,3,4,1,1,1,1,1))