開始使用免費開始

使用分面探索遺漏(多個圖)

搭配 geommisspoint() 的另一個實用技巧,是透過建立多個圖來探索遺漏情形。

就像我們在前面練習所做的,你可以使用 nabular 資料來建立更多分面圖。

你甚至可以依據資料中的數值(例如 year)與資料特性(例如遺漏情形)來建立多個分面圖。

本練習屬於課程

在 R 中處理遺漏值

檢視課程

練習說明

  • 使用 geom_miss_point()facet_wrap(),探索 wind_ewair_temp_c 的遺漏情形在 humidity 是否遺漏時有何不同。
  • 使用 geom_miss_point()facet_grid(),探索 wind_ewair_temp_c 的遺漏情形在 humidity 是否遺漏、以及依 year 分組時有何不同。

動手互動練習

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

# Use geom_miss_point() and facet_wrap to explore how the missingness  
# in wind_ew and air_temp_c is different for missingness of humidity
bind_shadow(oceanbuoys) %>%
  ggplot(aes(x = ___,
           y = ___)) + 
  geom_miss_point() + 
  facet_wrap(~___)

# Use geom_miss_point() and facet_grid to explore how the missingness in wind_ew and air_temp_c 
# is different for missingness of humidity AND by year - by using `facet_grid(humidity_NA ~ year)`
bind_shadow(oceanbuoys) %>%
  ggplot(aes(x = ___,
             y = ___)) + 
  geom_miss_point() + 
  facet_grid(humidity_NA~year)
編輯並執行程式碼