进一步探索更多缺失性的组合
了解每种缺失情况中的案例数量会很有用。
在本练习中,您将把 n() 放在 summarize() 函数中,添加关于已观测案例数量的信息。
随后,您还将通过增加一个分组层级,查看湿度是否缺失(humidity_NA)与气温是否缺失(air_temp_c_NA)的组合情况。
本练习是课程的一部分
在 R 中处理缺失数据
练习说明
在 wind_ew 上使用 group_by() 和 summarize():
- 按
air_temp_c_NA的缺失性汇总。 - 按
air_temp_c_NA与humidity_NA的缺失性进行汇总。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Summarize wind_ew by the missingness of `air_temp_c_NA`
oceanbuoys %>%
bind_shadow() %>%
group_by(___) %>%
summarize(wind_ew_mean = mean(___),
wind_ew_sd = sd(___),
n_obs = ___)
# Summarize wind_ew by missingness of `air_temp_c_NA` and `humidity_NA`
oceanbuoys %>%
bind_shadow() %>%
group_by(___, ___) %>%
summarize(wind_ew_mean = mean(___),
wind_ew_sd = sd(___),
n_obs = ___)