Professional Documents
Culture Documents
Applied Exercise 5
Applied Exercise 5
1. According to the data characteristics, we can remove the ID and gender, because
the valid data in this group is related to customer.
2. We can choose 3 cluster to describe
3. According to the K-means plot, we can see it elbow plot with 3 clusters.
4. I don’t think we can use 2, because there may have too many members.
Code&Results
library(dendextend)
library(reader)
library(psych)
library(dplyr)
library(ggplot2)
library(tibble)
library(cluster)
library(tidyr)
library(purrr)
plot(hc_customers)
count(segment_customers,cluster)
cluster n
1 1 44
2 2 120
3 3 114
# K means
library(animation)
ani.options(interval =1)
par(mar = c(3,3,1,1.5),mgp = c(1.5,0.5,0))
kmeans.ani()