開始使用免費開始

用散佈圖探索遺漏資料

ggplot2 的散佈圖中,遺漏值預設會被移除,並顯示警告。

我們可以用 geom_miss_point() 在散佈圖中顯示遺漏值。這是一個特別的 ggplot2 幾何物件,會將遺漏值移入圖中,顯示在該變數最小值下方 10% 的位置。

讓我們用 oceanbuoys 資料集來練習這種視覺化方式。

本練習屬於課程

在 R 中處理遺漏值

檢視課程

練習說明

  • 探索東西向風(wind_ew)與氣溫的遺漏情況,並用 geom_miss_point() 顯示遺漏值。
  • 探索濕度與氣溫的遺漏情況,並用 geom_miss_point() 顯示遺漏值。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Explore the missingness in wind and air temperature, and  
# display the missingness using `geom_miss_point()`
ggplot(oceanbuoys,
       aes(x = ___,
           y = ___)) + 
  geom_miss_point()

# Explore the missingness in humidity and air temperature,  
# and display the missingness using `geom_miss_point()`
ggplot(___,
       aes(x = ___,
           y = ___)) + 
  geom_miss_point()
編輯並執行程式碼