开始使用免费开始使用

Nabular 数据与按缺失情况汇总

在本练习中,我们将学习如何使用 nabular 数据,根据一个变量的缺失情况来探索另一个变量的变化。

我们将使用 naniar 中的 oceanbuoys 数据集,并通过分面创建多幅数据图。

这样可以让您探索不同层次的缺失情况。

本练习是课程的一部分

在 R 中处理缺失数据

查看课程

练习说明

  • 使用 geom_density() 并按空气温度的缺失情况(air_temp_c_NA)分面,探索风向东西分量(wind_ew)在空气温度缺失情况下的分布。
  • 在此可视化基础上,按湿度的缺失情况(humidity_NA)进行填充,以进一步完善图形。

交互式实操练习

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

# Explore the distribution of wind east west (wind_ew) for the missingness of air temperature 
# using geom_density() and faceting by the missingness of air temperature (air_temp_c_NA).
___ %>%
  bind_shadow(___) %>%
  ggplot(aes(x = ___)) + 
  geom_density() + 
  facet_wrap(~___)

# Build upon this visualization by coloring by the missingness of humidity (humidity_NA).
___ %>%
  ___(___) %>%
  ggplot(aes(x = ___,
             color = ___)) + 
  geom_density() + 
  ___(~___)
编辑并运行代码