Description Usage Arguments Details Examples
Scale a vector of values to the range [0, 1] based on rank/position
1 | relative_position(vals)
|
vals |
vector of values |
Values are ranked and then scaled to the range [0, 1]. Ties result in the same relative position
(e.g. relative_position(c(1, 2, 2, 3))
returns the vector c(0.0 0.5 0.5 1.0))
. NAs remain as NAs.
1 2 3 | relative_position(1:10)
relative_position(c(1, 2, 2, 3))
relative_position(c(1, NA, 3, 4))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.