視覺化兩個變數的遺漏情形

在 R 中處理遺漏值

Nicholas Tierney

Instructor

在二維中視覺化遺漏值的難題

ggplot(airquality,
       aes(x = Ozone,
           y = Solar.R)) + 
  geom_point()
Warning message:
Removed 42 rows containing 
missing values (geom_point).

在 R 中處理遺漏值

geom_miss_point() 簡介

ggplot(airquality,
       aes(x = Ozone,
           y = Solar.R)) + 
  geom_miss_point()

在 R 中處理遺漏值

補充:geom_miss_point() 的運作方式

Ozone Ozone_shift Ozone_NA
41 41.00000 !NA
36 36.00000 !NA
12 12.00000 !NA
18 18.00000 !NA
NA -19.72321 NA
28 28.00000 !NA
在 R 中處理遺漏值

用分面探索遺漏情形

ggplot(airquality,
       aes(x = Wind,
           y = Ozone)) + 
  geom_miss_point() + 
  facet_wrap(~ Month)

在 R 中處理遺漏值

用分面探索遺漏情形

airquality %>%
  bind_shadow() %>%
ggplot(aes(x = Wind,
           y = Ozone)) + 
  geom_miss_point() + 
  facet_wrap(~ Solar.R_NA)

在 R 中處理遺漏值

一起來練習吧!

在 R 中處理遺漏值

Preparing Video For Download...