全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
4122 2
2008-06-30
怎么查看str函数返回的某个分量
大致是这样的:
hc <- hclust(dist(USArrests), "ave") #运行hclust函数返回一个对象hc
str(hc)#想利用str函数查看对象hc中的某一个具体分量merge的数值

我这样尝试
bbb=str(hc)
bbb$merge,
结果返回一个null
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2008-6-30 18:56:00

看看参考文档,?hclust

Value

An object of class hclust which describes the tree produced by the clustering process. The object is a list with components:

mergean n-1 by 2 matrix. Row i of merge describes the merging of clusters at step i of the clustering. If an element j in the row is negative, then observation -j was merged at this stage. If j is positive then the merge was with the cluster formed at the (earlier) stage j of the algorithm. Thus negative entries in merge indicate agglomerations of singletons, and positive entries indicate agglomerations of non-singletons.
heighta set of n-1 non-decreasing real values. The clustering height: that is, the value of the criterion associated with the clustering method for the particular agglomeration.
ordera vector giving the permutation of the original observations suitable for plotting, in the sense that a cluster plot using this ordering and matrix merge will not have crossings of the branches.
labelslabels for each of the objects being clustered.
callthe call which produced the result.
methodthe cluster method that has been used.
dist.methodthe distance that has been used to create d (only returned if the distance object has a "method" attribute).

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2008-6-30 19:22:00

已经解决

str(hc)

看清个分量,结构

然后回头:

hc$merge

谢谢了

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群