-
Load the tidyverse and gapminder packages. Using group_by(), filter() and summarize(), create a table that identifies the countries that had the lowest and highest GDP per capita in each continent across all years. Using the arrange() function, order the rows alphabetically by continent and from lowest to highest GDP per capita. Remove all columns except those describing continent, country, gdpPercap and year.
-
Let’s visually see if this makes sense. Using all gapminder data, create a scatterplot with continent on the x-axis and GDP per capita on the y-axis. This type of graph is called a stripplot.
-
Do the same thing as above but this time using the table you created in question 1. Map the color of the points to the country variable.
-
Using all gapminder data, create a boxplot of GDP per capita across all continents (using geom_boxplot()).
-
Using all gapminder data, use the group_by() and summarize() functions to find the mean and median GDP per capita per continent. Print the resulting table.
-
Create a density plot (using geom_density()) of GDP per capita for each continent. Display GDP per capita in log10 scale by adding (+ scale_x_log10()) after calling geom_density().
-
Create a table of mean life expectancies in each continent for each year.