View source: R/percentile-rank.R
percentile_rank | R Documentation |
The bounds of the percentile rank are > 0 and < 1 (see Boundaries)
A percentile rank here is the proportion of scores that are less than the current score.
PR = (c_L + 0.5 f_i) / N
Where
c_L
is the frequency of scores less than the score of interest
f_i
is the frequency of the score of interest
percentile_rank(x, weights = times, times)
x |
A vector of values to rank |
weights , times |
A vector of the number of times to repeat |
Computes a percentile rank for each score in a set.
The percentile rank of x
between 0 and 1 (see Boundaries)
While the percentile rank of a score in a set must be exclusively within the
boundaries of 0
and 1
, this function may produce a percentile rank that
is exactly 0
or 1
. This may occur when the number of values are so large
that the value within the boundaries is too small to be differentiated.
Additionally, when using the weights
parameter, if the lowest or highest
number has a value of 0
, the number will then have a theoretical 0
or
1
, as these values are not actually within the set.
percentile_rank(0:9)
x <- c(1, 2, 1, 7, 5, NA_integer_, 7, 10)
percentile_rank(x)
if (package_available("dplyr")) {
dplyr::percent_rank(x)
}
# with times
percentile_rank(7:1, c(1, 0, 2, 2, 3, 1, 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.