Plotting and scheming
Before you get to work with rlang
to create a custom function, you'll create a scatterplot of two variables using ggplot2
, coloring by another variable. As a reminder, it is common for the variables given to be listed as "y versus x", where "y" corresponds to the variable plotted on the vertical axis and "x" is on the horizontal axis.
The dplyr
and ggplot2
packages, as well as the world_bank_2015
tibble, have been loaded for you for the exercises in this lesson. world_bank_2015
focuses on only the rows with year
equal to 2015
in the world_bank_data
tibble.
This exercise is part of the course
Programming with dplyr
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Fertility vs. infant mortality rate, colors by continent
scatter <- ggplot(___,
aes(x = infant_mortality_rate,
y = ___)) +
___(aes(color = ___))
scatter