聚类中需要有限的“ xlim”值-R

时间:2018-12-04 11:21:41

标签: r cluster-analysis

我正在根据观看的平均时间将聚类应用于视频的id变量,该时间是整数类型。这是我的代码:

myclusterdata = data[c(2,11)] #column 2 -->id

gower.dist <- daisy(xx, metric = c("gower"))
class(gower.dist)
#Divisive Clustering (Top-Down)
divisive.clust <- diana(as.matrix(gower.dist),  diss = TRUE, keep.diss = TRUE)
plot(divisive.clust, main = "Divisive")
#to which cluster each video belongs
cutree_object = cutree(divisive.clust, 3)
library(cluster)
clusplot(myclusterdata,
         cutree_object,
         lines = 0,
         shade = TRUE,
         color = TRUE,
         labels = 2,
         plotchar = FALSE,
         span = TRUE,
         main = "Videos clusters based on average time watched",
         xlab= "Videos",
         ylab= "average time")

尽管我之前已经尝试过该代码并且可以工作,但是现在当我重新运行它时,在运行最后一个绘图命令后,我会显示此错误:

  

plot.window(...)中的错误:需要有限的“ xlim”值此外:   警告消息:在sqrt(detA * pmax(0,yl2-y ^ 2))中:产生了NaNs

自从上次工作以来,我一直没有更改代码中的内容,那么可能是什么错误? 根据平均观看时间对视频ID进行聚类是否有意义,或者可以对视频数据(例如观看次数和展示次数)进行其他分析工作?

0 个答案:

没有答案