Comparing GDP per capita across continents
A boxplot is useful for comparing a distribution of values across several groups. In this exercise, you'll examine the distribution of GDP per capita by continent. Since GDP per capita varies across several orders of magnitude, you'll need to put the y-axis on a log scale.
Deze oefening maakt deel uit van de cursus
Introduction to the Tidyverse
Oefeninstructies
- Use the
gapminder_1952dataset (code is provided) to create a boxplot comparing GDP per capita (gdpPercap) among continents. Put the y-axis on a log scale withscale_y_log10().
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
library(gapminder)
library(dplyr)
library(ggplot2)
gapminder_1952 <- gapminder %>%
filter(year == 1952)
# Create a boxplot comparing gdpPercap among continents