[R] [FORGED] A problem with order() function in R

Rolf Turner r.turner at auckland.ac.nz
Tue Jul 18 07:12:21 CEST 2017


On 18/07/17 14:58, Jesadaporn Pupantragul wrote:
> Hello r-help
> I am learning R and use R-studio.
> I create vector x <- c(19,17,23,11) and use function order(x).
> The result show [1]  4 2 1 3. Why it doesn't show [1] 3 2 4 1.
> Follow picture that i attach.
> Thank you for you answer.

Perhaps this will give you some insight:

o <- order(x)
x[o]

cheers,

Rolf Turner

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276



More information about the R-help mailing list