使用非集群输入数据帧 (fci),从 apcluster() 创建一个 APResult,如下所示:
> apclr2q02 <- apcluster(negDistMat(r=2), fci)
> show(apclr2q02)
APResult object
Number of samples = 1045
Number of iterations = 826
Input preference = -22.6498
Sum of similarities = -1603.52
Sum of preferences = -1336.338
Net similarity = -2939.858
Number of clusters = 59
在线文档说 aggExCluster() 可以接受要聚类的数据作为输入,也可以接受以前的聚类结果(ExClust 或 APResult)。在非集群数据 (fci) 上运行 aggExCluster,代码按预期工作:
> aglomr2 <- aggExCluster(negDistMat(r=2), fci)
> aglomr2
AggExResult object
Number of samples = 1045
Maximum number of clusters = 1045
结果可以以树状图格式绘制,一切都很好;但是,使用上面获得的 APResult (apclr2q02) 作为输入,会返回以下错误:
> aglomr2 <- aggExCluster(negDistMat(r=2), apclr2q02)
Error in as.vector(data) :
no method for coercing this S4 class to a vector
关于我将 APResult 对象作为输入可能做错了什么的任何建议?