Gower's distance for R. Based in C, using openMP for parallelization.
library(gower)
reviris <- iris[rev(seq_len(nrow(iris))),,drop=FALSE]
# compute distances
d <- gower_dist(iris, reviris)
# data.frame with less records is recycled
d <- gower_dist(iris[1:3,,drop=FALSE], reviris)
# compute top-n matches
mat <- gower_topn(iris, reviris, n=5)
## mat$index : Array of indices (sorted from better to worse match)
## mat$distance: Array of distances (sorted from small to large)
More info in the vignette
install.packages("gower")
Made available through my drat repo.
First, install the drat package. Users of the OS who's name shall not be mentioned need to install Rtools first.
if(!require(drat)) install.packages('drat')
drat::addRepo('markvanderloo')
install.packages('gower',type='source')
Gower (1971) A general coefficient of similarity and some of its properties. Biometrics 27 857-874 pdf