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

John jwd at surewest.net
Tue Jul 18 07:52:26 CEST 2017


On Tue, 18 Jul 2017 09:58:19 +0700
Jesadaporn Pupantragul <jp.beckmcs at gmail.com> 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.

You might want to ask why you would ever see "[1] 3 2 4 1" as a result
of order(). A descending order would yield [1] 3 1 2 4.

JDougherty



More information about the R-help mailing list