dist | R Documentation |
Computes the distances between all rows of in x
.
## S4 method for signature 'CompositionMatrix'
dist(x, method = "euclidean", diag = FALSE, upper = FALSE, p = 2)
x |
A |
method |
A |
diag |
A |
upper |
A |
p |
An |
Distances are computed on CLR-transformed data.
A stats::dist
object.
N. Frerebeau
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.
stats::dist()
Other statistics:
aggregate()
,
condense()
,
covariance()
,
mahalanobis()
,
margin()
,
mean()
,
pip()
,
quantile()
,
scale()
,
variance()
,
variance_total()
,
variation()
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.