This function calculates a variety of dissimilarity or distance metrics. Although it duplicates the functionality of dist() and bcdist(), it is written entirely in R, and can easily be extended to include additional metrics.
Usage
distance(x, method = "euclidean")
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 5 dissimilarity metrics can be calculated:
euclidean
bray-curtis
manhattan
mahalanobis
jaccard
Partial matching will work for selecting a method.
Value
Returns a lower-triangular distance matrix as an object of class "dist".