`vegdist` 提供了多个计算差异度的算法。这些算法自然是各有各的适用范围。对于同一个数据集，其结果有什么直观上的差异呢？

``````library(vegan)
library(pheatmap)
library(cowplot)
data("varespec")
dist.methods <- c("manhattan", "euclidean", "canberra", "clark", "bray", "kulczynski", "jaccard", "gower", "altGower", "morisita", "horn", "mountford", "raup", "binomial", "chao", "cao" , "mahalanobis")
``````

``````dist.plots <- vector("list",length(dist.methods))
for (i in seq_along(dist.methods)){
dist <- vegdist(varespec,method = dist.methods[[i]])
plot <- pheatmap(dist,cluster_cols = F,cluster_rows = F,main = dist.methods[[i]],silent = T)
dist.plots[[i]] = plot[]
}
``````
``````## Warning in vegdist(varespec, method = dist.methods[[i]]): results may be
## meaningless with non-integer data in method "morisita"
``````
``````## Warning in vegdist(varespec, method = dist.methods[[i]]): results may be
## meaningless with non-integer data in method "chao"
``````
``````## Warning in vegdist(varespec, method = dist.methods[[i]]): results may be
## meaningless with non-integer data in method "cao"
``````

``````plot_grid(plotlist = dist.plots,labels = "AUTO",ncol=4)
`````` ### 作者简介

Chun-Hui Gao is a Research Associate at Huazhong Agricultural University.

### 引用本文

``gaoch (2018). 比较不同差异系数的结果. BIO-SPRING. https://bio-spring.top/post/2018/11/20/comparing-dissimilarity-index/``

BibTeX citation

``````@misc{
title = "比较不同差异系数的结果",
author = "gaoch",
year = "2018",
journal = "BIO-SPRING",
note = "https://bio-spring.top/post/2018/11/20/comparing-dissimilarity-index/"
}``````