Learn R Programming

genMCMCDiag (version 0.2.3)

hammingDist: Hamming Distance

Description

Simple function to return the Hamming distance between two objects. Acts elementwise.

Usage

hammingDist(x, y)

Value

Numeric, elementwise Hamming distance between x and y.

Arguments

x

Binary vector or matrix

y

Binary vector or matrix of same dimensions as x.

Examples

Run this code
x <- matrix(c(1,0,
              0,0), nrow = 2, byrow = TRUE)
y <- diag(1,2)
hammingDist(x, y)

Run the code above in your browser using DataLab