开始使用免费开始使用

Nabular 数据与按缺失情况分组填充

汇总统计很有用,但俗话说,"一图胜千言"。

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

我们将使用 naniar 中的 oceanbuoys 数据集。

本练习是课程的一部分

在 R 中处理缺失数据

查看课程

练习说明

  • 先使用 vis_miss() 探索 oceanbuoys 的缺失结构。
  • 使用 geom_density(),根据气温是否缺失来探索风向东西分量(wind_ew)的分布。
  • 使用 geom_density(),根据湿度是否缺失来探索海温的分布。

交互式实操练习

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

# First explore the missingness structure of `oceanbuoys` using `vis_miss()`
vis_miss(___)

# Explore the distribution of `wind_ew` for the missingness  
# of `air_temp_c_NA` using  `geom_density()`
bind_shadow(oceanbuoys) %>%
  ggplot(aes(x = ___, 
             color = air_temp_c_NA)) + 
  geom_density()

# Explore the distribution of sea temperature for the  
# missingness of humidity (humidity_NA) using  `geom_density()`
  ___(___) %>%
  ggplot(aes(x = ___,
             color = ___)) + 
  geom_density()
编辑并运行代码