Session Ready
Exercise

Hierarchical clustering: Preparing for exploration

You have now created a potential clustering for the oes data, before you can explore these clusters with ggplot2 you will need to process the oes data matrix into a tidy data frame with each occupation assigned its cluster.

Instructions
100 XP
  • Create the df_oes data frame from the oes data.matrix, making sure to store the rowname as a column (use rownames_to_column() from the tibble library)
  • Build the cluster assignment vector cut_oes using cutree() with a h = 100,000
  • Append the cluster assignments as a column cluster to the df_oes data frame and save the results to a new data frame called clust_oes
  • Use the gather() function from the tidyr() library to reshape the data into a format amenable for ggplot2 analysis and save the tidied data frame as gather_oes