## Importing packages
install.packages("magick")
install.packages('animation', repos = 'http://rforge.net', type = 'source')
library(amap)##kmeans  
library(R2SWF)  
library(animation)##  
customer <- read.csv("C:\\Users\\User\\Documents\\ga38tan\\Kaggle\\Data Science Bowl 2019\\train_labels.csv")##  
train_labels <- customer[,c(6,7)]##(6:7)  
output = dev2swf({  
  par(mar = c(3, 3, 1, 1.5), mgp = c(1.5, 0.5, 0))  
  kmeans.ani(x = train_labels, centers = 3, ##  
             hints = c("Move centers!", "Find cluster?"), pch = 1:3, col = 1:3)  
}, output = "train_labels.swf")##flash  
swf2html(output)##HTML  

result=kmeans(train_labels,3)
result$centers