我正在使用R聚类一个名为“tissuedata”的矩阵。我有一个使用以下代码生成的hclust对象:
TissueDist<-dist(tissuedata, method="euclidean")
TissueClust<-hclust(TissueDist, method='complete')
现在,我想从TissueClust中打印出行名,同时保留群集行的顺序。有什么建议?
这是“组织数据”矩阵可能包含的示例:
Brain Bone Breast Lung Ovary Pancreas HeLa
17271422_17271984_ENSG00000026025 -3.266758 0.000000 -3.215719 -5.248721 0 -2.891329 -3.718194
17272608_17272709_ENSG00000026025 -4.304518 -4.560667 -3.359868 0.000000 0 -3.108627 -4.227678
17272632_17272709_ENSG00000026025 -4.188425 -4.444906 -3.243362 0.000000 0 -2.992122 -4.111259
17272649_17272709_ENSG00000026025 -3.984628 -4.338187 -3.104413 0.000000 0 -2.791452 -3.828157
17275586_17275681_ENSG00000026025 -3.278478 -3.932706 -2.903414 -4.480172 0 -2.781268 -3.423038
17276692_17276817_ENSG00000026025 -3.355184 -4.351640 -3.009279 0.000000 0 -3.231431 -4.194499
17276692_17276850_ENSG00000026025 -3.456211 -4.453457 -3.110306 0.000000 0 -3.332458 -4.294992
17277845_17277888_ENSG00000026025 -3.842749 -4.195861 -2.661506 0.000000 0 -2.373369 -3.436403
17277845_17277908_ENSG00000026025 -4.005683 -4.358526 -2.824233 0.000000 -1 -2.536096 -3.599131
最佳答案
我不确定我是否理解正确的问题.....
# $labels gives orginal ordering form matrix
TissueClust$labels
# $order gives the permutation of the original observations
# see ?hclust detail section
TissueClust$order
# not sure, but are you looking for this?
TissueClust$labels[c(TissueClust$order)]
hth
关于r - 如何在R中打印hclust对象的行?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18062844/