powered by
Simple function to return the Hamming distance between two objects. Acts elementwise.
hammingDist(x, y)
Numeric, elementwise Hamming distance between x and y.
Binary vector or matrix
Binary vector or matrix of same dimensions as x.
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