Visualizing median GDP per capita by continent
A bar plot is useful for visualizing summary statistics, such as the median GDP in each continent.
Deze oefening maakt deel uit van de cursus
Introduction to the Tidyverse
Oefeninstructies
- Use
group_by()andsummarize()to find the median GDP per capita within each continent in the year 1952, calling the output columnmedianGdpPercap. Use the assignment operator<-to save it to a dataset calledby_continent. - Use the
by_continentdataset to create a bar plot showing the median GDP per capita in each continent.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
library(gapminder)
library(dplyr)
library(ggplot2)
# Summarize the median gdpPercap by continent in 1952
# Create a bar plot showing medianGdp by continent