Exploring the clusters
Because clustering analysis is always in part qualitative, it is incredibly important to have the necessary tools to explore the results of the clustering.
In this exercise you will explore that data frame you created in the previous exercise lineup_k2_complete
.
Reminder: The lineup_k2_complete
data frame contains the x & y positions of 12 players at the start of a 6v6 soccer game to which you have added clustering assignments based on the following parameters:
- Distance: Euclidean
- Number of Clusters (k): 2
- Linkage Method: Complete
This exercise is part of the course
Cluster Analysis in R
Exercise instructions
- Using
count()
from dplyr, count the number of players assigned to each cluster. - Using
ggplot()
, plot the positions of the players and color them by cluster assignment.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Count the cluster assignments
count(lineup_k2_complete, ___)
# Plot the positions of the players and color them using their cluster
ggplot(lineup_k2_complete, aes(x = ___, y = ___, color = factor(___))) +
geom_point()