gpt4 book ai didi

r - 如何在 R 中打印 hclust 对象的行?

转载 作者:行者123 更新时间:2023-12-01 15:15:40 24 4
gpt4 key购买 nike

我正在使用 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)]

关于r - 如何在 R 中打印 hclust 对象的行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18062844/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com