可视化两个变量间的缺失情况

在 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...