Compute the Hamming distance (the number of non-overlapping characters) between words of the same length.
Usage
hamming.distance(xsource, targets)
Arguments
xsource
A character string to compute the Hamming distance from.
targets
Words to which the Hamming distance must be computed. Must be of type character, or convertible to type character with as.character.
Value
An integer vector containing Hamming distances, with names corresponding to targets. Since the Hamming distances is only defined between words of the same length, the output of hamming.distance is only guaranteed to have the same length as targets if all targets have the same length as source.
Details
The actual distance computation is performed by stringdist with "method='h'".
References
Hamming, R. W. (1950). Error detecting and error correcting codes. Bell System technical journal, 29(2), 147-160.