Session Ready
Exercise

Exercise 10. Dollars per day - part 4 - stacked density plot

Now we are going to edit the code from Exercise 9 to show a stacked density plot of each region in Africa.

Instructions
100 XP
  • Much of the code will be the same as in Exercise 9:
    • Create the dollars_per_day variable as in Exercise 7, but for African countries in the years 1970 and 2010 this time.
    • Make sure you remove any NA values.
    • Create a smooth density plot of dollars per day for 1970 and 2010 using a log (base 2) scale for the x axis.
    • Use facet_grid to show a different density plot for 1970 and 2010.
  • Make sure the densities are smooth by using bw = 0.5.
  • Use the fill and position arguments where appropriate to create the stacked density plot of each region.