按缺失情况探索差异:箱线图
在前面的练习中,您使用 nabular 数据配合密度图,按另一个变量的缺失情况来探索某个变量的变化。
这一次我们将使用 naniar 中的 oceanbuoys 数据集,改用箱线图来探索不同层次的缺失情况,而不是使用分面或其他方法。
本练习是课程的一部分
在 R 中处理缺失数据
练习说明
- 使用
geom_boxplot()按气温缺失情况,探索东西向风速(wind_ew)的分布。 - 在此可视化基础上,按湿度的缺失情况(
humidity_NA)进行分面。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Explore the distribution of wind east west (`wind_ew`) for
# the missingness of air temperature using `geom_boxplot()`
oceanbuoys %>%
bind_shadow() %>%
ggplot(aes(x = air_temp_c___,
y = ____)) +
geom_____()
# Build upon this visualization by faceting by the missingness of humidity (`humidity_NA`).
oceanbuoys %>%
___() %>%
ggplot(aes(x = ___,
y = ___)) +
geom_____() +
facet_wrap(~___)