chickadee » statistics » ranks

ranks sequenceprocedure

Returns the 1-based ranks of the elements of sequence, in their original order. Tied values share the mean of the ranks they occupy. Sorts once, so it takes O(n log n) time.

> (ranks '(10 20 20 30))
(1 5/2 5/2 4)