dist: Distances

distR Documentation

Distances

Description

Computes the distances between all rows of in x.

Usage

## S4 method for signature 'CompositionMatrix'
dist(x, method = "euclidean", diag = FALSE, upper = FALSE, p = 2)

Arguments

x

A CompositionMatrix object.

method

A character string specifying the distance measure to be used. See stats::dist() for the available distances.

diag

A logical scalar indicating whether the diagonal of the distance matrix should be printed.

upper

A logical scalar indicating whether the upper triangle of the distance matrix should be printed.

p

An integer giving the power of the Minkowski distance.

Details

Distances are computed on CLR-transformed data.

Value

A stats::dist object.

Author(s)

N. Frerebeau

References

Aitchison, J. (1986). The Statistical Analysis of Compositional Data. London: Chapman and Hall, p. 64-91.

Greenacre, M. J. (2019). Compositional Data Analysis in Practice. Boca Raton: CRC Press.

See Also

stats::dist()

Other statistics: aggregate(), condense(), covariance(), mahalanobis(), margin(), mean(), pip(), quantile(), scale(), variance(), variance_total(), variation()

Examples

## Data from Aitchison 1986
data("hongite")

## Coerce to compositional data
coda <- as_composition(hongite)

## Aitchison distance
## (euclidean distance between CLR-transformed compositions)
d <- dist(coda)

## Cluster dendrogram
h <- hclust(d, method = "ward.D2")
plot(h)

nexus documentation built on Sept. 11, 2024, 6:43 p.m.