R-唱片标签矢量 [英] R - Phylogram labels to vector
本文介绍了R-唱片标签矢量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我们使用ape
包从分层聚类中绘制出系统进化图
If we plot a phylogram from hierarchical clustering using ape
package
phy <- hclust(dist(mtcars))
plot(as.phylo(phy),direction="downwards")
有没有一种方法可以将标签以与系统图中出现的顺序相同的顺序提取到载体中(从左到右读取)?
Is there a way to extract the labels in to a vector in the same order they appear in the phylogram (read from left to right)?
如果我尝试
phy$labels
我可以拿出标签,但它们的显示顺序不同.
I can get the labels out but they appear to be in a different order.
推荐答案
使用附加的order
组件,您可以按照正确的顺序获取它们
Using the additional order
component, you can get them in the proper ordering
with(phy, labels[order])
# [1] "Maserati Bora" "Chrysler Imperial" "Cadillac Fleetwood"
# [4] "Lincoln Continental" "Ford Pantera L" "Duster 360"
# [7] "Camaro Z28" "Hornet Sportabout" "Pontiac Firebird"
# [10] "Hornet 4 Drive" "Valiant" "Merc 450SLC"
# ...
这篇关于R-唱片标签矢量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文