ranks
Map an array of numbers into their fractional ranks
Usage
// [1, 4, 3, 2, 6, 5]
Use the fractional mean in the case of ties:
// [2, 2, 2, 4] // [2.5, 2.5, 2.5, 2.5]
Tests
Run the unit tests with npm test
:
> ava tests.js
✔ rank should map arrays to their ranks
✔ rank should resolve ties at the mean
2 tests passed