View source: R/utility_functions.R
Rank | R Documentation |
Ranking a vector
Rank(x, decreasing = FALSE)
x |
a numeric vector |
decreasing |
logical. Should the sort order be increasing or decreasing? (defualt: FALSE) |
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
the rank of the vector elements
a = c(10, 20, 50, 30, 40)
Rank(a)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.