Cluster Analysis in R
Dmitriy (Dima) Gorenshteyn
Lead Data Scientist, Memorial Sloan Kettering Cancer Center
print(lineup)
x y
1 -1 1
2 -2 -3
3 8 6
4 7 -8
... ... ...
model <- kmeans(lineup, centers = 2)
print(model$cluster)
1 1 2 2 1 1 1 2 2 2 1 2
lineup_clustered <- mutate(lineup, cluster = model$cluster)
print(lineup_clustered)
x y cluster
<dbl> <dbl> <int>
1 -1 1 1
2 -2 -3 1
3 8 6 2
4 7 -8 2
... ... ... ...
Cluster Analysis in R