October 2017
Beginner to intermediate
572 pages
26h 1m
English
Perform the following steps to cluster the customer dataset with the k-means method:
> set.seed(22) > fit = kmeans(customer, 4) > fit Output K-means clustering with 4 clusters of sizes 8, 11, 16, 25 Cluster means: Visit.Time Average.Expense Sex Age 1 1.3302016 1.0155226 -1.4566845 0.5591307 2 -0.7771737 -0.5178412 -1.4566845 -0.4774599 3 0.8571173 0.9887331 0.6750489 1.0505015 4 -0.6322632 -0.7299063 0.6750489 -0.6411604 Clustering vector: [1] 2 2 1 2 1 2 1 1 2 2 2 1 1 2 2 2 1 2 1 3 4 3 4 3 3 4 4 3 [29] 4 4 4 3 3 3 4 4 3 4 4 4 4 4 4 4 3 3 4 4 4 3 4 3 3 4 4 4 [57] 3 4 4 3 Within cluster sum of squares by cluster: [1] 5.90040 11.97454 22.58236 20.89159 (between_SS / ...
Read now
Unlock full access