MulaiMulai sekarang secara gratis

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

Latihan ini adalah bagian dari kursus

Cluster Analysis in R

Lihat Kursus

Petunjuk latihan

  • 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.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# 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()
Edit dan Jalankan Kode