gorder: Ordering Permutation

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/04operations.R

Description

gorder returns a permutation which rearranges its first argument into ascending or descending order.

Usage

1
gorder(x, decreasing = FALSE, stable = TRUE, sortx=FALSE)

Arguments

x

object to be ordered

decreasing

logical to specify sort order

stable

make sure that ties are in the original order

sortx

if sortx=TRUE, then x will be modified by sorting it. This avoids an extra duplication of the x. By leaving sortx=FALSE, an extra duplication of x is performed to avoid changing the input value.

Details

Unlike the base R function, only one input column may be given. The thrust library is used for this operation.

Value

a gvector of type "integer" which will permute the input vector to the proper sort order.

Author(s)

Nathan Morris

See Also

order

Examples

1
2
3
x=grnorm(10)
i=gorder(x)
x[i] #sort x

gmatrix documentation built on May 19, 2017, 11:43 a.m.

Search within the gmatrix package
Search all R packages, documentation and source code