PercentRank: Percent Ranks

View source: R/DescTools.r

PercentRankR Documentation

Percent Ranks

Description

PercentRank() takes a vector x and returns the percentile that elements of x correspond to.

Usage

PercentRank(x)

Arguments

x

a numeric, complex, character or logical vector.

Value

A numeric vector of the same length as x with names copied from x (unless na.last = NA, when missing values are removed). The vector is of integer type unless x is a long vector.

Author(s)

Andri Signorell <andri@signorell.net>

See Also

Rank, rank, factor, order, sort

Examples

(r1 <- rank(x1 <- c(3, 1, 4, 15, 92)))

x2 <- c(3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5)
names(x2) <- letters[1:11]
(r2 <- rank(x2))        # ties are averaged

PercentRank(x2)

DescTools documentation built on Nov. 20, 2023, 5:08 p.m.