Rank: Ranking a vector

View source: R/utility_functions.R

RankR 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)


PLEXI documentation built on Aug. 9, 2023, 5:08 p.m.

Related to Rank in PLEXI...