order: Ordering permutation

Description Usage Arguments Value Note See Also Examples

Description

order returns a permutation which rearranges its first argument into ascending or descending order, breaking ties by further arguments.

NOTE: This man page is for the order S4 generic function defined in the BiocGenerics package. See ?base::order for the default method (defined in the base package). Bioconductor packages can define specific methods for objects (typically vector-like) not supported by the default method.

Usage

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

Arguments

...

One or more vector-like objects, all of the same length.

na.last, decreasing, method

See ?base::order for a description of these arguments.

Value

The default method (see ?base::order) returns an integer vector of length N where N is the common length of the input objects. This integer vector represents a permutation of N elements and can be used to rearrange the first argument in ... into ascending or descending order (by subsetting it).

Specific methods defined in Bioconductor packages should also return an integer vector representing a permutation of N elements.

Note

TO DEVELOPERS:

Specific order methods should preferably be made "stable" for consistent behavior across platforms and consistency with base::order(). Note that C qsort() is not "stable" so order methods that use qsort() at the C-level need to ultimately break ties by position, which can easily be done by adding a little extra code at the end of the comparison function passed to qsort().

order(x, decreasing=TRUE) is not always equivalent to rev(order(x)).

order, sort, and rank methods for specific vector-like objects should adhere to the same underlying order that should be conceptually defined as a binary relation on the set of all possible vector values. For completeness, this binary relation should also be incarnated by a <= method.

See Also

Examples

1
2
3
order
showMethods("order")
selectMethod("order", "ANY")  # the default method

nturaga/BiocGenerics documentation built on May 7, 2019, 11:15 a.m.