Create histogram of imputed data
Now that we can recreate the first visualization of geom_miss_point(), let's explore how we can apply this to other exploratory tasks.
One useful task is to evaluate the number of missings in a given variable using a histogram. We can do this using the ocean_imp_track dataset we created in the last exercise, which is loaded into this session.
This exercise is part of the course
Dealing With Missing Data in R
Exercise instructions
Using the imputed and tracked data, ocean_imp_track:
- Explore the values of
air_temp_c, visualizing the amount of missings withair_temp_c_NA. - Explore the missings in
humidityusinghumidity_NA. - Explore the missings in
air_temp_caccording to year, usingfacet_wrap(~year). - explore the missings in
humidityaccording to year, usingfacet_wrap(~year).
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Explore the values of air_temp_c, visualizing the amount of missings with `air_temp_c_NA`.
p <- ggplot(___, aes(x = ___, fill = ___)) + ___()
# Expore the missings in humidity using humidity_NA
p2 <- ggplot(___, aes(x = ___, fill = ___)) + ___()
# Explore the missings in air_temp_c according to year, using `facet_wrap(~year)`.
p + facet_wrap(~___)
# Explore the missings in humidity according to year, using `facet_wrap(~year)`.
p2 + facet_wrap(~___)