Learn R Programming

kairos (version 2.2.0)

permute: Rearrange a Data Matrix

Description

Rearranges a data matrix according to a permutation order.

Usage

permute(object, order, ...)

# S4 method for data.frame,PermutationOrder permute(object, order)

# S4 method for matrix,PermutationOrder permute(object, order)

Value

A permuted matrix or a permuted data.frame (the same as object).

Arguments

object

A \(m \times p\) numeric matrix or data.frame of count data (absolute frequencies giving the number of individuals for each category, i.e. a contingency table).

order

A PermutationOrder object giving the permutation order for rows and columns.

...

Currently not used.

Author

N. Frerebeau

See Also

Other seriation methods: as_seriation(), assess(), order(), refine(), seriate_average(), seriate_rank()

Examples

Run this code
## Replicates Desachy 2004 results
data("compiegne", package = "folio")

## Get seriation order for columns on EPPM using the reciprocal averaging method
## Expected column order: N, A, C, K, P, L, B, E, I, M, D, G, O, J, F, H
(indices <- seriate_rank(compiegne, EPPM = TRUE, margin = 2))

## Get permutation order
order_rows(indices)
order_columns(indices)

## Permute columns
(new <- permute(compiegne, indices))

Run the code above in your browser using DataLab