Skip to contents

Calculate the percentile of value x in a set of numbers

Usage

percentile(x, vector, digits = 4, na.rm = TRUE)

Arguments

x

A numeric value.

vector

A set of numeric values.

digits

Integer indicating the number of decimal places (round) or significant digits (signif) to be used.

na.rm

Logical. Should missing values (including NaN) be removed?

Value

A numeric value.

Examples

percentile(2, c(1, 5))
#> [1] 0.5
percentile(2, c(1, 3, 5), digits = 2)
#> [1] 0.33