Exercise: Plot life expectancy by country

Create a bar chart showing the life expectancy of the five biggest countries by population in 2007.

  1. Use the ggplot() function and specify the gapminder_top5 dataset as input
  2. Add a geom_col() layer to the plot
  3. Plot one bar for each country (x aesthetic)
  4. Use life expectancy lifeExp as bar height (y aesthetic)
Output

Submit code to see output here.

Create your first bar chart