swap: Swap two items of a permutation

View source: R/PerMallows.R

swapR Documentation

Swap two items of a permutation

Description

Given a permutation and two position, swap both positions

Usage

swap(perm, i, j)

Arguments

perm

a permutation

i

position of the permutation

j

position of the permutation

Value

The permutation in the input in which the two speicfied items have been swapped

Examples

swap(c(1,2,3,4,5),2,5)

PerMallows documentation built on April 3, 2025, 11:09 p.m.

Related to swap in PerMallows...