LoslegenKostenlos loslegen

Evaluating imputations: Across many variables

So far, we have covered ways to look at individual variables or pairs of variables and their imputed values. However, sometimes you want to look at imputations for many variables. To do this, you need to perform some data munging and re-arranging. This lesson covers how to perform this data wrangling, which can get a little bit hairy when considering its usage in nabular data. The function, shadow_long() gets the data into the right shape for these kinds of visualizations.

Diese Übung ist Teil des Kurses

Dealing With Missing Data in R

Kurs anzeigen

Anleitung zur Übung

  • Use the shadow_long() to gather the imputed data ocean_imp_mean, focussing on humidity and air_temp_c.
  • Print the data and inspect it.
  • Explore the imputations in a histogram using geom_histogram(), placing the values on the x-axis, filling by their missingness and faceting by variable

Interaktive Übung

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

# Gather the imputed data 
ocean_imp_mean_gather <- shadow_long(___,
                                     ___,
                                     ___))
# Inspect the data
___

# Explore the imputations in a histogram 
ggplot(ocean_imp_mean_gather, 
       aes(x = value, fill = value_NA)) + 
  geom_histogram() + 
  facet_wrap(~variable)
Code bearbeiten und ausführen