Instructions

Answer the following questions and complete the exercises in RMarkdown. Please embed all of your code and push your final work to your repository. Your final lab report should be organized, clean, and run free from errors. Remember, you must remove the # for the included code chunks to run. Be sure to add your name to the author header above. For any included plots, make sure they are clearly labeled. You are free to use any plot type that you feel best communicates the results of your analysis.

Make sure to use the formatting conventions of RMarkdown to make your report neat and clean!

Load the libraries

library(tidyverse)
library(janitor)
options(scipen = 999)

Data

For this homework, we are going to use the Gapminder data on population (pop), GDP per capita (gdp), and life expectancy (lex). These data were downloaded and compiled using the gapminder_compile.Rmd script in the data folder.

Let’s focus our attention on data from the past 100 years, between 1925 and 2025.

gapminder <- read_csv("data/gapminder.csv") %>% 
  clean_names() %>% 
  filter(between(year, 1925, 2025))
  1. Use the function(s) of your choice to get an idea of the overall structure of the data, including its dimensions, column names, classes, etc.

  2. How many countries are represented in this dataset?

  3. Which five countries have had the largest absolute population growth between 1925-2025? Show this as a table.

  4. Make a plot that shows population growth over time for the top country you found in question #3.

  5. Has global life expectancy changed between 1925 and 2025? Show the min, median, mean, and max for all countries (combined) in the dataset.

  6. Make a plot that shows the distribution of life expectancy for all countries in 1925 and 2025 (try using geom_density). What do you notice about the shift in life expectancy over time?

  7. We are interested in the relationship between per capita GDP and life expectancy; i.e. does having more money help you live longer in 2025? Show this as a plot. (Suggestion! Remove Monaco as an extreme outlier.)

  8. Which five countries have had the highest absolute GDP per capita growth over the past 50 years? Show this as a table. (Suggestion! Remove Monaco as an extreme outlier.)

  9. How does per capita GDP growth compare between these same five countries over the past 50 years? Show this as a plot.

  10. Do one analysis of your choice that includes a table and plot as outputs.

Knit and Upload

Please knit your work as an .html file and upload to Canvas. Homework is due before the start of the next lab. No late work is accepted. Make sure to use the formatting conventions of RMarkdown to make your report neat and clean!