# orderx

0th

Percentile

##### Ordering Permutation

orderx has the same functionality as order, except that orderx(..., from=from, to=to) is the same as order[from:to]

Keywords
manip, univar
##### Usage
orderx(x, from=1, to=length(x), decreasing=FALSE, na.last = NA)
##### Arguments
x

an atomic vector

from,to

order(..., from=from, to=to) equals order(...)[from:to]

decreasing

logical. Should the sort order be increasing or decreasing?

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 (see the Notes in order)

##### Details

The smaller the difference to-from is compared to the length of x, the faster is orderx compared to order.

Particularly, orderx(..., from=k, to=k) is much faster than order(...)[k].

orderx is never really slower than order.

For further details see order.

##### Value

integer vector of length to-from+1.

sortx

• orderx
##### Examples
# NOT RUN {
x <- runif(10^6)
k <- 10
system.time(y<-order(x)[1:k])
system.time(z<-orderx(x, from=1, to=k)) ## much faster
stopifnot(all(x[y ]== x[z])) ## same result
# }

Documentation reproduced from package RandomFieldsUtils, version 0.5.3, License: GPL (>= 3)

### Community examples

Looks like there are no examples yet.