inverse.perm: Generate inverse permutation

Description Usage Arguments Value Examples

View source: R/PerMallows.R

Description

This function generates the inverse of a given permutation. If the input is a matrix of permutations, invert all the permutations in the input.

Usage

1

Arguments

perm

a permutation or matrix of permutations

Value

The inverse permutation. If the input is a matrix,the matrix with the inverses

Examples

1
2
3
4
inverse.perm(c(1,2,3,4))
inverse.perm(c(2,3,4,1))
data <- matrix(c(1,2,3, 4,1,4,3,2,1,2,4,3), nrow = 3, ncol = 4, byrow = TRUE)
inverse.perm(data)

Example output

Loading required package: Rcpp
[1] 1 2 3 4
[1] 4 1 2 3
     [,1] [,2] [,3] [,4]
[1,]    1    2    3    4
[2,]    1    4    3    2
[3,]    1    2    4    3

PerMallows documentation built on May 2, 2019, 6:14 a.m.