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

Correlation matrix as heatmap

Should you want to check correlations betweens hundreds of time series, representing correlations with numbers is not really helpful - for a dataset of 100 elements, you would have to analyze 10,000 (100 x 100) correlation numbers!

In this case, a heatmap is a better suited tool. A heatmap is a map or diagram in which data values are represented as colors. When using one, it might also be useful to reorder the correlation matrix to make it more readable. You can create heatmaps using corrplot(method = "color").

In this exercise, you will create some heatmaps with the same correlation matrix cor_mat as from the previous exercise.

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

Visualizing Time Series Data in R

ดูคอร์ส

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

  • Draw a heatmap of cor_mat
  • Draw the upper heatmap
  • Draw the upper heatmap ordering the matrix using hclust in the order argument

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

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

# Draw heatmap of cor_mat


# Draw upper heatmap


# Draw the upper heatmap with hclust
แก้ไขและรันโค้ด