orderv: Order by a list of vectors.

View source: R/orderv.R

ordervR Documentation

Order by a list of vectors.

Description

Produce an ordering permutation from a list of vectors. Essentially a non-... interface to order.

Usage

orderv(
  columns,
  ...,
  na.last = TRUE,
  decreasing = FALSE,
  method = c("auto", "shell", "radix")
)

Arguments

columns

list of atomic columns to order on, can be a data.frame.

...

not used, force later arguments to bind by name.

na.last

(passed to order) 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.

decreasing

(passed to order) 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 .... For the other methods, it must be length one.

method

(passed to order) the method to be used: partial matches are allowed. The default ("auto") implies "radix" for short numeric vectors, integer vectors, logical vectors and factors. Otherwise, it implies "shell". For details of methods "shell", "quick", and "radix", see the help for sort.

Value

ordering permutation

See Also

order, sortv

Examples


d <- data.frame(x = c(2, 2, 3, 3, 1, 1), y = 6:1)
d[order(d$x, d$y), , drop = FALSE]
d[orderv(d), , drop = FALSE]


wrapr documentation built on Aug. 20, 2023, 1:08 a.m.