distance: Compute the distance between permutations

Description Usage Arguments Value Examples

View source: R/PerMallows.R

Description

Compute the distance between two given permutations. If only one permutation is given the other one is assumed to be the identity (1,2,3,....,n) The distance can be kendall, cayley, hamming and ulam

Usage

1
2
distance(perm1, perm2 = identity.permutation(length(perm1)),
  dist.name = "kendall")

Arguments

perm1

a permutation

perm2

optional a permutation

dist.name

optional. One of: kendall (default), cayley, hamming, ulam

Value

The distance between the permutations

Examples

1
2
3
distance(c(1,2,3,5,4))
distance(c(1,2,3,5,4), c(1,2,3,5,4))
distance(c(1,2,3,5,4), c(1,4,2,3,5), "cayley")

Example output

Loading required package: Rcpp
[1] 1
[1] 0
[1] 3

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