R: Compute Distance Between Rows of a Matrix

rowDist {ChemoSpec} | R Documentation

## Compute Distance Between Rows of a Matrix

### Description

This function is a wrapper to compute the distance between rows of a matrix using a number of methods. Some of these are available in package `stats` and some in `Dist` from package amap. This function determines which method is requested and then the distance calculation is done by the appropriate method. The exception is the cosine distance which is calculated locally.

### Usage

    rowDist(x, method)

### Arguments

`x` | A matrix whose rows will be used for the distance calculation.
`method` | A character; one of `c("pearson"`, `"correlation"`, `"spearman"`, `"kendall"`, `"euclidean"`, `"maximum"`, `"manhattan"`, `"canberra"`,`"binary"`, `"minkowski"`, `"cosine")`.

### Details

Methods `c("euclidean"`, `"maximum"`, `"manhattan"`, `"canberra"`,`"binary"`, `"minkowski")` are sent to function `dist` in package `stats` while methods `c("pearson"`, `"correlation"`, `"spearman"`, `"kendall")` are handled by `Dist` in package `amap`. See the respective help pages for details. `"cosine"` is handled locally.

### Value

An object of class `dist`.

### Author(s)

Bryan A. Hanson, DePauw University. Suggested by and original code written by Roberto Canteri.

[Package ChemoSpec version 4.4.97 Index]