quantileRank
quantileRank(
x,value):number
Defined in: src/quantile_rank.js:20
This function returns the quantile in which one would find the given value in
the given array. It will copy and sort your array before each run, so
if you know your array is already sorted, you should use quantileRankSorted
instead.
Parameters
Section titled “Parameters”number[]
input
number
the value for which to find the quantile rank
Returns
Section titled “Returns”number
the quantile rank
Throws
Section titled “Throws”if x is empty
Example
Section titled “Example”quantileRank([4, 3, 1, 2], 3); // => 0.75quantileRank([4, 3, 2, 3, 1], 3); // => 0.7quantileRank([2, 4, 1, 3], 6); // => 1quantileRank([5, 3, 1, 2, 3], 4); // => 0.8