Rankings
When a dataset is sorted in ascending order, a rank is assigned to each value. Ranking is a process where the dataset is transformed and values are replaced by their ranks. Julia provides functions for various types of rankings.
In ordinal ranking, all items in the dataset are assigned a distinct value. Items that have equal values are assigned a ranking arbitrarily. In Julia, this is done using the ordinalrank
function.
Suppose this is our dataset and we want to do ordinal ranking:
Using the ordinalrank(arr)
function, we've got the ordinal ranking. Similarly, StatsBase also provides functions to find other types of rankings, such as competerank()
, denserank()
, and tiedrank()
.