sortv: Sort a data.frame.

View source: R/orderv.R

sortvR Documentation

Sort a data.frame.

Description

Sort a data.frame by a set of columns.

Usage

sortv(
  data,
  colnames,
  ...,
  na.last = TRUE,
  decreasing = FALSE,
  method = c("auto", "shell", "radix")
)

Arguments

data

data.frame to sort.

colnames

column names to sort on.

...

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

orderv

Examples


d <- data.frame(x = c(2, 2, 3, 3, 1, 1), y = 6:1)
sortv(d, c("x", "y"))


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