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.
Latihan ini adalah bagian dari kursus
Dealing With Missing Data in R
Petunjuk latihan
- Use the
shadow_long()to gather the imputed dataocean_imp_mean, focussing onhumidityandair_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 byvariable
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# 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)