Rank {mnda} | R Documentation |
Ranking a vector
Description
Ranking a vector
Usage
Rank(x, decreasing = FALSE)
Arguments
x |
a numeric vector |
decreasing |
logical. Should the sort order be increasing or decreasing? (defualt: FALSE) |
Details
hint: What is the difference between Order and Rank
Order: [the index of the greatest number, ..., the index of the smallest number]
Rank: [the rank of the 1st number, ..., the rank of the last number]
In Rank, the order of the numbers remains constant so can be used for ranksum.
ex)
> a = c(10, 20, 50, 30, 40)
> order(a)
[1] 1 2 4 5 3]]
> Rank(a)
[1] 1 2 5 3 4
Value
the rank of the vector elements
Examples
a = c(10, 20, 50, 30, 40)
Rank(a)
[Package mnda version 1.0.9 Index]