NAs are sorted first in the dimension table, see ramorder.integer64.
This function automatically chooses from several low-level functions considering the size of x and the availability of a cache.
Suitable methods are sortorderkey (fast ordering)
and orderkey (memory saving ordering).
See Also
unique.integer64 for the unique subset and match.integer64 for finding positions in a different vector.