hamming_distance: Calculate Hamming distance

Description Usage Arguments Author(s) References Examples

View source: R/hamming_distance.R

Description

Linear algebraic way to compute pairwise Hamming distances from a matrix. This is much faster than using double For loops.

Usage

1

Arguments

X

A matrix that contains real values

Author(s)

Peter I-Fan Wu

References

https://johanndejong.wordpress.com/2015/09/23/fast-hamming-distance-in-r/

Examples

1
2
3
4
5
mat=matrix(c(1,1,0,0,
             1,0,1,1,
             1,0,0,0
          ),nrow=3,byrow=T)
hamming_distance(mat)

peterwu19881230/microbialPhenotypes documentation built on March 19, 2021, 6:36 a.m.