hammingDist {genMCMCDiag} | R Documentation |
Hamming Distance
Description
Simple function to return the Hamming distance between two objects. Acts elementwise.
Usage
hammingDist(x, y)
Arguments
x |
Binary vector or matrix |
y |
Binary vector or matrix of same dimensions as x. |
Value
Numeric, elementwise Hamming distance between x and y.
Note
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!
Examples
x <- matrix(c(1,0,
0,0), nrow = 2, byrow = TRUE)
y <- diag(1,2)
hammingDist(x, y)
[Package genMCMCDiag version 0.2.2 Index]