powered by
In one pass over the vector NAs are handled according to parameter na.last by range_sortna(), then, if the vector is unsorted, bit sort is invoked.
NA
na.last
range_sortna()
bitsort(x, na.last = NA, depth = 1)
a sorted vector
an integer vector
NA removes NAs, FALSE puts NAs at the beginning, TRUE puts NAs at the end
FALSE
TRUE
an integer scalar giving the number of bit-passed before switching to quicksort
bitsort(c(2L, 0L, 1L, NA, 2L)) bitsort(c(2L, 0L, 1L, NA, 2L), na.last=TRUE) bitsort(c(2L, 0L, 1L, NA, 2L), na.last=FALSE)
Run the code above in your browser using DataLab