将HCPC对象强制为hclust to use library(ape)

将HCPC对象强制为hclust to use library(ape),r,hierarchical-clustering,coercion,R,Hierarchical Clustering,Coercion,我目前正在执行分层群集。我选择使用FactoMineR,因为它的数据探索管道很好:data->MFA->HCPC data("wine") names(wine) res<-MFA(wine,group = c(2,5,3,10,9,2),type=c("n",rep("s",5)), ncp=5,name.group = c("orig","olf","vis","olfag","gust","ens"), num.group.sup = c(1,6)

我目前正在执行分层群集。我选择使用
FactoMineR
,因为它的数据探索管道很好:data->MFA->HCPC

data("wine")
names(wine)
res<-MFA(wine,group = c(2,5,3,10,9,2),type=c("n",rep("s",5)),
         ncp=5,name.group = c("orig","olf","vis","olfag","gust","ens"),
         num.group.sup = c(1,6))

res.hcpc<-HCPC(res, nb.clust=0, consol=F, iter.max=10, min=3, 
           max=NULL, metric="euclidean", method="ward", order=TRUE,
           graph.scale="sqrt-inertia", nb.par=5, graph=TRUE, proba=0.05, 
           cluster.CA="rows",kk=Inf)

#Now for some nice plots
plot(res.hcpc,draw.tree = T,choice = "tree")
plot(res.hcpc,draw.tree = T,choice = "bar")
数据(“葡萄酒”)
姓名(葡萄酒)
res用于图书馆(ape)


hcpcTreethe
hclust
中的
部分准确地告诉您是什么构成了一个hclust对象,因此您只需填充这些孔,例如,
h2@rawr,我已经查看了
hclust
的结构。我要开始,想办法让这一切顺利进行。由于没有编程背景,我希望拥有更好R开发血统的人能够提供一个可行的函数,该函数可以包含在
FactoMineR
包中。i、 e起重机所需的正确结构和用途
hcpcTree<-res.hcpc$call$t$tree
apeTree<-as.phylo(hcpcTree)
dendextendTree<-as.phylo.dendrogram(hcpcTree)