開始使用免費開始

Nabular 資料與依遺漏狀態填補

摘要統計很有用,但俗話說,一張圖勝過千言萬語。

在這個練習中,你將學習如何使用 nabular 資料,依另一個變數的遺漏狀態來探索某變數的變異。

我們會使用 naniar 套件中的 oceanbuoys 資料集。

本練習屬於課程

在 R 中處理遺漏值

檢視課程

練習說明

  • 先用 vis_miss() 探索 oceanbuoys 的遺漏結構。
  • 使用 geom_density(),依空氣溫度的遺漏狀態,探索東西向風(wind_ew)的分布。
  • 使用 geom_density(),依濕度的遺漏狀態,探索海水溫度的分布。

動手互動練習

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

# First explore the missingness structure of `oceanbuoys` using `vis_miss()`
vis_miss(___)

# Explore the distribution of `wind_ew` for the missingness  
# of `air_temp_c_NA` using  `geom_density()`
bind_shadow(oceanbuoys) %>%
  ggplot(aes(x = ___, 
             color = air_temp_c_NA)) + 
  geom_density()

# Explore the distribution of sea temperature for the  
# missingness of humidity (humidity_NA) using  `geom_density()`
  ___(___) %>%
  ggplot(aes(x = ___,
             color = ___)) + 
  geom_density()
編輯並執行程式碼