Sort a data.frame by a set of columns.
sortv(
data,
colnames,
...,
na.last = TRUE,
decreasing = FALSE,
method = c("auto", "shell", "radix")
)
data.frame to sort.
column names to sort on.
not used, force later arguments to bind by name.
(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.
(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.
ordering permutation
# NOT RUN {
d <- data.frame(x = c(2, 2, 3, 3, 1, 1), y = 6:1)
sortv(d, c("x", "y"))
# }
Run the code above in your browser using DataLab