Get startedGet started for free

Visualize imputed values in a scatter plot

Now, let's recreate one of the previous plots we saw in chapter three that used geom_miss_point().

To do this, we need to impute the data below the range of the data. This is a special kind of imputation to explore the data. This imputation will illustrate what we need to practice: how to track missing values. To impute the data below the range of the data, we use the function impute_below_all().

This exercise is part of the course

Dealing With Missing Data in R

View Course

Exercise instructions

Using the oceanbuoys data:

  • Impute and track the missing values using bind_shadow() and impute_below_all(), and add_label_shadow().
  • Visualize the missingness in wind and air temperature on the x and y-axis respectively, coloring missing air temp values with air_temp_c_NA.
  • Visualize humidity and air temp on the x and y-axis respectively, coloring any missing cases using the variable any_missing.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Impute and track the missing values
ocean_imp_track <- bind_shadow(___) %>% 
  impute_below_all() %>% 
  add_label_shadow()

# Visualize the missingness in wind and air temperature,  
# coloring missing air temp values with air_temp_c_NA
ggplot(___, 
       aes(x = ___, y = ___, color = ___)) + 
  geom_point()

# Visualize humidity and air temp, coloring any missing cases using the variable any_missing
ggplot(___, 
       aes(x = ___, y = ___, color = ___)) +  
  geom_point()
Edit and Run Code