Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

get_order

Extracting Order Information from a Permutation Object


Description

Method to get the order information from an object of class ser_permutation or ser_permutation_vector. Order information can be extracted as an integer permutation vector, a vector containing the object ranks or a permutation matrix.

Usage

get_order(x, ...)
## S3 method for class 'ser_permutation_vector'
get_order(x, ...)
## S3 method for class 'ser_permutation'
get_order(x, dim = 1, ...)

get_rank(x, ...)

get_permutation_matrix(x, ...)

Arguments

x

an object of class ser_permutation or ser_permutation_vector.

dim

order information for which dimension should be returned?

...

further arguments are ignorred for get_order. For get_rank and for get_permutation_matrix the additional arguments are passed on to get_order (e.g., as dim).

Details

get_order returns the seriation as an integer vector containing the order of the objects after permutation. That is, the index of the first, second, ..., n-th object. These permuation vectors can directly be used to reorder objects using subsetting with "[". Note: In seriation we usually use these order-based permutation vectors.

get_rank returns the seriation as an integer vector containing the rank/position for each objects in the permutation. That is, position of the first, second, ..., n-th object after permutation. Note: Use order() to convert ranks back to an order.

get_permutation_matrix returns a n x n permutation matrix.

Value

Returns an integer permutation vector/a permutation matrix.

Author(s)

Michael Hahsler

See Also

Examples

## permutation_vector
o <- ser_permutation_vector(sample(10))
o

get_order(o)
get_rank(o)
get_permutation_matrix(o)

## permutation
o2 <- ser_permutation(o, sample(5))
o2

get_order(o2, dim = 2)
get_rank(o2, dim = 2)
get_permutation_matrix(o2, dim = 2)

seriation

Infrastructure for Ordering Objects Using Seriation

v1.2-9
GPL-3
Authors
Michael Hahsler [aut, cre, cph], Christian Buchta [aut, cph], Kurt Hornik [aut, cph], Fionn Murtagh [ctb, cph], Michael Brusco [ctb, cph], Stephanie Stahl [ctb, cph], Hans-Friedrich Koehn [ctb, cph]
Initial release
2020-09-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.