資料探勘---聚類動畫演示
阿新 • • 發佈:2019-01-06
我 的資源
聚類動畫示例演示:
setwd("E://RProgramming//聚類動畫")
library(R2SWF)
library(animation)
output = dev2swf({
par(mar = c(3, 3, 1, 1.5), mgp = c(1.5, 0.5, 0))
kmeans.ani()
}, output = "test.swf")
swf2html(output)
中國城市聚類動畫演示:
setwd("E://RProgramming//中國地圖動畫聚類")
library(R2SWF)
library(animation)
data<-read.csv("citycoordinate.csv" )
# View(data)
x<-data$東經
# View(x)
y<-data$北緯
output = dev2swf({
par(mar = c(3, 3, 1, 1.5), mgp = c(1.5, 0.5, 0))
# par(x,y)
kmeans.ani(x=cbind(x,y),centers = 4)
}, output = "test.swf")
swf2html(output)
工資和收入聚類動畫演示:
setwd("E://RProgramming//customer")
library(R2SWF)
library(animation)
data<-read .csv("customer.csv")
# View(data)
xx<-data$age
# View(x)
yy<-data$income
output = dev2swf({
par(mar = c(3, 3, 1, 1.5), mgp = c(1.5, 0.5, 0))
# par(x,y)
# kmeans.ani(x=cbind(xx,yy),centers = 4)
kmeans.ani(x = cbind(xx, yy), centers = 3,
hints = c("Move centers!", "Find cluster?" ), pch = 1:3, col = 1:3)
}, output = "test.swf")
swf2html(output)