Exercise 11. Infant mortality scatter plot - part 1
We are going to continue looking at patterns in the gapminder dataset by plotting infant mortality rates versus dollars per day for African countries.
This exercise is part of the course
Data Science Visualization - Module 2
Exercise instructions
- Generate
dollars_per_day
usingmutate
andfilter
for the year 2010 for African countries.- Remember to remove
NA
values.
- Remember to remove
- Store the mutated dataset in
gapminder_Africa_2010
. - Make a scatter plot of
infant_mortality
versusdollars_per_day
for countries in the African continent. - Use color to denote the different regions of Africa.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
library(dplyr)
library(ggplot2)
library(dslabs)
data(gapminder)
gapminder_Africa_2010 <- # create the mutated dataset
# now make the scatter plot