Get startedGet started for free

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

View Course

Exercise instructions

Using the imputed and tracked data, ocean_imp_track:

  • Explore the values of air_temp_c, visualizing the amount of missings with air_temp_c_NA.
  • Explore the missings in humidity using humidity_NA.
  • Explore the missings in air_temp_c according to year, using facet_wrap(~year).
  • explore the missings in humidity according to year, using facet_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(~___)
Edit and Run Code