distHamming function

Hamming distance between two ranks

Hamming distance between two ranks

The Hamming distance between two ranks x and y is the number of difference between the two ranks. For example, the Hamming's distance between x=(1,4,2,5,3) and y=(1,3,4,5,2) is 3 because, only 1 and 5 have the same place in both ranks.

distHamming(x, y)

Arguments

  • x, y: two ranks of size m.

Returns

an integer, the Hamming distance between x and y.

Examples

x <- 1:5 y <- c(2, 3, 1, 4, 5) distHamming(x, y)

See Also

Other distance: distCayley(), distKendall(), distSpearman()

Author(s)

Julien Jacques

  • Maintainer: Quentin Grimonprez
  • License: GPL (>= 2)
  • Last published: 2022-11-12

Useful links