【发布时间】:2017-09-07 11:56:40
【问题描述】:
【问题讨论】:
标签: r dendrogram ape-phylo
【问题讨论】:
标签: r dendrogram ape-phylo
两个选项,取决于您的数据
如果您需要计算数据的距离矩阵,请使用
set.seed(1) # makes random sampling with rnorm reproducible
# example matrix
m <- matrix(rnorm(100), nrow = 5) # any MxN matrix
distm <- dist(m) # distance matrix
hm <- hclust(distm)
plot(hm)
如果你的数据是距离矩阵(必须是方阵!)
set.seed(1)
# example matrix
m <- matrix(rnorm(25), nrow=5) # must be square matrix!
distm <- as.dist(m)
hm <- hclust(distm)
plot(hm)
一个 200 x 200 的距离矩阵给了我一个合理的情节
set.seed(1)
# example matrix
m <- matrix(rnorm(200*200), nrow=200) # must be square matrix!
distm <- as.dist(m)
hm <- hclust(distm)
plot(hm)
【讨论】: