# 比较不同差异系数的结果

`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)`` 