Description Usage Arguments Details Value Author(s)
Order augments the base order() function to work with data.frames, lists, etc.
1 |
sort.on |
a data.frame, list, matrix, 2D-array, table or vector. If sort.on is a list, all elements must be vectors of the same length. All other classes will be coerced to list. The first element in the list will used for sorting; additional elements (if supplied) will be used to break ties. |
... |
additional vector arguments, all of the same length (which must be equal to the number of rows of sort.on). This argument permits Order to be called in the same manner as the base order() function. |
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. |
decreasing |
logical. Should the sort order be increasing or decreasing? |
This function is just a wrapper for link{order}
that permits it to
be called with more complex objects. For example, if you wanted to sort a
data.frame x based on the contents of its first three columns...
> Order(x)
... would give the same result as:
> order(x[, 1], x[, 2], x[, 3])
a vector of integers specifying the permutation that will result in ordering of the elements of sort on
M.W.Rowe, mwr.stats@gmail.com
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.