Learn R Programming

PerMallows (version 1.13)

inversion: Inversion operator

Description

Given a permutation and a position, swap positions i and i+1

Usage

inversion(perm, i)

Arguments

perm
a permutation
i
position of the permutation

Value

The permutation in the input with an inversion at the specified position

Examples

Run this code
inversion(c(1,2,3,4,5),2)

Run the code above in your browser using DataLab