Get startedGet started for free

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

View Course

Exercise instructions

  • Generate dollars_per_day using mutate and filter for the year 2010 for African countries.
    • Remember to remove NA values.
  • Store the mutated dataset in gapminder_Africa_2010.
  • Make a scatter plot of infant_mortality versus dollars_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
Edit and Run Code