[R] Question about base::rank results

Giorgio Garziano giorgio.garziano at ericsson.com
Sun Apr 26 10:17:48 CEST 2015


Hi,

I cannot understand why rank(x) behaves as outlined below.
Based on the results of first x vector values ranking, which is as expected in my opinion,
I cannot explain the following results.

> x <- c(12,34,15,77,78)
> x[rank(x)]
[1] 12 15 34 77 78      (OK)

> x <- c(12,34,15,77,78,22)
> x[rank(x)]
[1] 12 77 34 78 22 15   (?)

> x <- c(12,34,77,15,78)
> x[rank(x)]
[1] 12 77 15 34 78      (?)

Please any feedback ? Thanks.

BR,

Giorgio Garziano



	[[alternative HTML version deleted]]



More information about the R-help mailing list