hammingDist {genMCMCDiag} | R Documentation |
Simple function to return the Hamming distance between two objects. Acts elementwise.
hammingDist(x, y)
x |
Binary vector or matrix |
y |
Binary vector or matrix of same dimensions as x. |
Numeric, elementwise Hamming distance between x and y.
For speed, no error handling if x and y do not have the same dimensions. Also, does not test to make sure x,y are binary, take care!
x <- matrix(c(1,0,
0,0), nrow = 2, byrow = TRUE)
y <- diag(1,2)
hammingDist(x, y)