Week 3 Assignment: Core Analysis with Gapminder

Author

Sarp Ata Kanca

Published

March 8, 2026

The Economic Question

How have GDP per capita and life expectancy evolved across different continents since 1952? Which continents have seen the fastest growth, and which countries are outliers?

install.packages(“tidyverse”) install.packages(“dplyr”) library(tidyverse) library(dplyr)

gapminder_wide <-read.csv(“Econ_465_Sarp/Data/gapminder_wide(1).csv”)

gap_life_selected <- gapminder_wide |> select(continent, contains(“lifeExp”))

gap_life_selected

unique(gap_tidy$continent)

gap_tidy <- gapminder_wide |> pivot_longer( cols = -c(country,continent), names_to = c(“.value”, “year”), names_sep = “_“, values_drop_na=FALSE

)|> mutate(year = as.numeric(year))

glimpse(gap_tidy)

gap_tidy

##to here I used all my week 3 handouts and notes as a reference

continent_trends <- gap_tidy |> group_by(continent,year) |> summarize( avg_gdp = mean(gdpPercap, na.rm = TRUE), avg_lifeExp = mean(lifeExp, na.rm = TRUE), .group = “drop” ) continent_trends ##I_needed some extra help to clearify my data and I used some claudea AI advice with specify which codes I need to makes thinks work

Assignment Instructions

This assignment is designed to help you practice the data cleaning and transformation skills you learned in Week 3. You will work with the Gapminder dataset to answer the economic question above.

Before You Start:

##Which Continets Have rapidly Growth: I calculated and take average growth for GPD and Life epentecy and suprisingly Ocenia have biggest growth rate in GPD with 2,89 times growth (I divided to last to first to see how much growth happened). However, Asia has more life expentency growth with 1,52 times growth since 1952.

##Who are the outliers: For each continents there are several outliers which are increase or decrease our median data. For Africa, Botswana and Lesosto. Botswana have unexepected hightence in economic growth compared to neighbor Africa countries, in other perspective Lethoso have lower life expentency than others. For Asia Japan is the outlier because exceptional high life expentancy and Qatar extremly high GDP per capita. For Europe Luxemburg and Norway have significantly higher income levels thant continent average. In America U.S. is a high-icome outlier while Haiti pull average lower levels. Lastly, in OCenia,Australia and New Zealand display high level at GDP rather than other countries listed in our data.

  • Read each part carefully. The questions ask you to explain your thinking, not just provide code.
  • Use the lab handout as a reference b