Nabular 資料與依遺漏情形進行摘要
在這個練習中,你將學習如何使用 nabular 資料,根據另一個變數的遺漏情形來探索某個變數的變化。
我們會使用 naniar 套件裡的 oceanbuoys 資料集,接著利用分面產生多張圖來檢視資料。
這能幫助你從不同層次來觀察遺漏值。
本練習屬於課程
在 R 中處理遺漏值
練習說明
- 使用
geom_density()並依空氣溫度是否遺漏(air_temp_c_NA)進行分面,探索風向東西向(wind_ew)在空氣溫度遺漏情形下的分佈。 - 進一步強化這個視覺化,將填色依相對溼度的遺漏情形(
humidity_NA)來設定。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Explore the distribution of wind east west (wind_ew) for the missingness of air temperature
# using geom_density() and faceting by the missingness of air temperature (air_temp_c_NA).
___ %>%
bind_shadow(___) %>%
ggplot(aes(x = ___)) +
geom_density() +
facet_wrap(~___)
# Build upon this visualization by coloring by the missingness of humidity (humidity_NA).
___ %>%
___(___) %>%
ggplot(aes(x = ___,
color = ___)) +
geom_density() +
___(~___)