gower icon indicating copy to clipboard operation
gower copied to clipboard

Gower's distance for R

Build Status Coverage Status CRAN status Downloads

gower

Gower's distance for R. Based in C, using openMP for parallelization.

Usage

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

Installation

From CRAN

install.packages("gower")

Beta versions

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')

Reference

Gower (1971) A general coefficient of similarity and some of its properties. Biometrics 27 857-874 pdf