Get startedGet started for free

Exercise 7. Dollars per day - part 1

Now we are going to calculate and plot dollars per day for African countries in 2010 using GDP data.

In the first part of this analysis, we will create the dollars per day variable.

This exercise is part of the course

Data Science Visualization - Module 2

View Course

Exercise instructions

  • Use mutate to create a dollars_per_day variable, which is defined as gdp/population/365.
  • Create the dollars_per_day variable for African countries for the year 2010.
  • Remove any NA values.
  • Save the mutated dataset as daydollars.

Hands-on interactive exercise

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

library(dplyr)
library(dslabs)
data(gapminder)
daydollars <- # write your code here
Edit and Run Code