开始使用免费开始使用

使用分面探索缺失情况(多图)

在使用 geom_miss_point() 时,另一种有用的方法是通过创建多张图来探索缺失情况。

就像前面的练习一样,我们可以使用 nabular 数据来帮助创建更多的分面图。

我们甚至可以根据数据中的取值(例如 year)以及数据的特征(例如缺失情况)来创建多重分面图。

本练习是课程的一部分

在 R 中处理缺失数据

查看课程

练习说明

  • 使用 geom_miss_point()facet_wrap(),探索在 humidity 缺失与否的情况下,wind_ewair_temp_c 的缺失情况有何不同。
  • 使用 geom_miss_point()facet_grid(),按 yearhumidity 的缺失与否来探索 wind_ewair_temp_c 的缺失情况差异。

交互式实操练习

通过完成这段示例代码来试试这个练习。

# 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)
编辑并运行代码