# Calculate dissimilarity/distance metrics

### Description

This function calculates a variety of dissimilarity or distance metrics. Although it duplicates the functionality of dist() and bcdist(), it is written in such a way that new metrics can easily be added. distance() was written for extensibility and understandability, and is not an efficient choice for use with large matrices.

### Usage

1 |

### Arguments

`x` |
matrix or data frame with rows as samples and columns as variables (such as species). Distances will be calculated for each pair of rows. |

`method` |
Currently 7 dissimilarity metrics can be calculated: "euclidean", "bray-curtis", "manhattan", "mahalanobis", "jaccard", "difference", "sorensen", "gower", "modgower10" (modified Gower, base 10), "modgower2" (modified Gower, base 2). Partial matching will work for selecting a method. |

`sprange` |
Gower dissimilarities offer the option of dividing by the species range. If sprange=NULL no range is used. If sprange is a vector of length nrow(x) it is used for standardizing the dissimilarities. |

`spweight` |
Euclidean, Manhattan, and Gower dissimilarities allow weighting. If spweight=NULL, no weighting is used. If spweight="absence", then W=0 if both species are absent and 1 otherwise, thus deleting joint absences. |

### Value

Returns a lower-triangular distance matrix as an object of class "dist".

### Author(s)

Sarah Goslee <Sarah.Goslee@ars.usda.gov>

### See Also

`dist`

### Examples

1 2 |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.