LoslegenKostenlos loslegen

Further exploring more combinations of missingness

It can be useful to get a bit of extra information about the number of cases in each missing condition.

In this exercise, we are going to add information about the number of observed cases using n() inside the summarize() function.

We will then add an additional level of grouping by looking at the combination of humidity being missing (humidity_NA) and air temperature being missing (air_temp_c_NA).

Diese Übung ist Teil des Kurses

Dealing With Missing Data in R

Kurs anzeigen

Anleitung zur Übung

Using group_by() and summarize() on wind_ew:

  • Summarize by the missingness of air_temp_c_NA.
  • Summarize by missingness of air_temp_c_NA and humidity_NA.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# 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 = ___)
Code bearbeiten und ausführen