Keyed Ordering Permutation

order2(
  ...,
  key = identity,
  na.last = TRUE,
  decreasing = FALSE,
  method = c("auto", "shell", "radix")
)

Arguments

...

a sequence of numeric, complex, character or logical vectors, all of the same length, or a classed R object.

key

A function that takes a single argument, defaults to identity

na.last

for controlling the treatment of NAs. If TRUE, missing values in the data are put last; if FALSE, they are put first; if NA, they are removed (see ‘Note’.)

decreasing

logical. Should the sort order be increasing or decreasing? For the "radix" method, this can be a vector of length equal to the number of arguments in ... and the elements are recycled as necessary. For the other methods, it must be length one.

method

the method to be used: partial matches are allowed. The default ("auto") implies "radix" for numeric vectors, integer vectors, logical vectors and factors with fewer than \(2^{31}\) elements. Otherwise, it implies "shell". For details of methods "shell", "quick", and "radix", see the help for sort.

Value

An integer vector with the ordered indices of the input data