R: Conversion Between Permutation Vector and Permutation Matrix

permutation_matrix {seriation} | R Documentation

## Conversion Between Permutation Vector and Permutation Matrix

### Description

Converts between permutation vectors and matrices.

### Usage

    permutation_matrix2vector(x)
    permutation_vector2matrix(x)

### Arguments

`x` | A permutation vector (any object that can be converted into a permutation vector, e.g., a integer vector or a `hclust` object) or a matrix representing a permutation. Arguments are checked.

### Author(s)

Michael Hahsler

### See Also

`ser_permutation`, `permute`

### Examples

    ## create a random permutation vector
    pv <- sample(1:5)
    pv

    ## convert into a permutation matrix
    pm <- permutation_vector2matrix(pv)
    pm

    ## convert back
    permutation_matrix2vector(pm)

[Package seriation version 1.2-8 Index]