使用分面探索缺失情况(多图)
在使用 geom_miss_point() 时,另一种有用的方法是通过创建多张图来探索缺失情况。
就像前面的练习一样,我们可以使用 nabular 数据来帮助创建更多的分面图。
我们甚至可以根据数据中的取值(例如 year)以及数据的特征(例如缺失情况)来创建多重分面图。
本练习是课程的一部分
在 R 中处理缺失数据
练习说明
- 使用
geom_miss_point()和facet_wrap(),探索在humidity缺失与否的情况下,wind_ew与air_temp_c的缺失情况有何不同。 - 使用
geom_miss_point()和facet_grid(),按year和humidity的缺失与否来探索wind_ew与air_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)