sortBy package:vector-algorithms is:exact

A fully parameterized version of the sorting algorithm. Again, this function takes both radix information and a comparison, because the algorithms falls back to insertion sort for small arrays.
Sorts an entire array using a custom ordering.
Sorts an entire array using a given comparison
A variant on sortBy which returns a vector of unique elements.
Sorts an array using a custom comparison.
Radix sorts an array using custom radix information requires the number of passes to fully sort the array, the size of of auxiliary arrays necessary (should be one greater than the maximum value returned by the radix function), and a radix function, which takes the pass and an element, and returns the relevant radix.