【发布时间】:2018-09-07 03:48:02
【问题描述】:
我需要通过模板来可视化我的集群。 我的意思是,这是我的数据。
mydat<- read.csv("mydat.csv",sep=";", dec=",")
输入
structure(list(x1 = c(0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L), x2 = c(0L, 0L, 0L,
0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 0L,
0L, 0L), x3 = c(0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), x4 = c(0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L
), x5 = c(0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), x6 = c(0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 1L),
x7 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L,
0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L), x8 = c(0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L,
0L)), .Names = c("x1", "x2", "x3", "x4", "x5", "x6", "x7",
"x8"), class = "data.frame", row.names = c(NA, -21L))
我进行了聚类分析
library("apcluster")
apres1 <- apclusterK(negDistMat(r=2), df, K=25)
apres1
为 Ken.S 编辑 我试过这样做
plot(apres1, mydat)
我不想要 25 个地块,我想要 1 个地块,就像我执行分类一样
【问题讨论】:
-
@KenS。我编辑了描述的帖子,我做了什么
标签: r ggplot2 package cluster-analysis