Learn R Programming

coda.base (version 1.0.3)

dist: Distance Matrix Computation (including Aitchison distance)

Description

This function overwrites dist function to contain Aitchison distance between compositions.

Usage

dist(x, method = "euclidean", ...)

Value

dist returns an object of class "dist".

Arguments

x

compositions method

method

the distance measure to be used. This must be one of "aitchison", "euclidean", "maximum", "manhattan", "canberra", "binary" or "minkowski". Any unambiguous substring can be given.

...

arguments passed to dist function

See Also

See functions dist.

Examples

Run this code
X = exp(matrix(rnorm(10*50), ncol=50, nrow=10))

(d <- dist(X, method = 'aitchison'))
plot(hclust(d))

# In contrast to Euclidean distance
dist(rbind(c(1,1,1), c(100, 100, 100)), method = 'euc') # method = 'euclidean'
# using Aitchison distance, only relative information is of importance
dist(rbind(c(1,1,1), c(100, 100, 100)), method = 'ait') # method = 'aitchison'

Run the code above in your browser using DataLab