使用分面探索遺漏(多個圖)
搭配 geommisspoint() 的另一個實用技巧,是透過建立多個圖來探索遺漏情形。
就像我們在前面練習所做的,你可以使用 nabular 資料來建立更多分面圖。
你甚至可以依據資料中的數值(例如 year)與資料特性(例如遺漏情形)來建立多個分面圖。
本練習屬於課程
在 R 中處理遺漏值
練習說明
- 使用
geom_miss_point()與facet_wrap(),探索wind_ew與air_temp_c的遺漏情形在humidity是否遺漏時有何不同。 - 使用
geom_miss_point()與facet_grid(),探索wind_ew與air_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)