เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Hierarchical clustering: Plotting occupational clusters

You have successfully created all the parts necessary to explore the results of this hierarchical clustering work. In this exercise you will leverage the named assignment vector cut_oes and the tidy data frame gathered_oes to analyze the resulting clusters.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Cluster Analysis in R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • View the assignments of each occupation to their clustering by sorting the cut_oes vector using sort().
  • Use ggplot2 to plot each occupation's average income by year and color the lines by the occupation's assigned cluster.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# View the clustering assignments by sorting the cluster assignment vector
sort(___)

# Plot the relationship between mean_salary and year and color the lines by the assigned cluster
ggplot(___, aes(x = ___, y = ___, color = factor(___))) + 
    geom_line(aes(group = occupation))
แก้ไขและรันโค้ด