R - cluster analysis on binary weblog data

风流意气都作罢 提交于 2019-12-06 05:09:16

You could try a hierarchical clustering using a binary distance measure like jaccard, if "clicked a link" is asymmetrical:

dat <- read.table(header = TRUE, row.names = 1, text = "User   link1 link2 link3 link4
abc1     0     1     1     1
abc2     1     0     1     0
abc3     0     1     1     1
abc4     1     0     1     0")
d <- dist(dat, method = "binary")
hc <- hclust(d)
plot(hc)

(clusters <- cutree(hc, k = 2))
# abc1 abc2 abc3 abc4 
#    1    2    1    2
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!