The element a full sort would place at 1-based rank nth, without sorting -- O(n)
rather than O(n log n). index optionally reports which element of values that was.
The reported index is the one a full STABLE sort would give. std::nth_element
normally leaves an arbitrary member of an equal-comparing run at that position; here
the comparator ends with a tiebreaker on the original index, making it a total order
under which no two elements compare equal, so the answer is deterministic and agrees
with pf_sort element for element.
nth counts NULLS too, placed by the same tier rules as the sort (last by default).
Takes descending/nulls_first/is_valid exactly as pf_argsort does.