
Introduction to Global Health Data Science
Duke University
STA/GLHLTH 198 Fall 2026
2026-08-24
IHME data on location (mostly countries), World Bank region, binary sex, and estimated life expectancy and population in 2023 will be used to explore the men’s health gap (later we will add more years).

Dr. Abernathy of The Simpsons (aged 40)
Rows: 204
Columns: 6
$ location <chr> "Afghanistan", "Albania", "Algeria", "A…
$ year <dbl> 2023, 2023, 2023, 2023, 2023, 2023, 202…
$ worldbankregion <chr> "South Asia", "Europe and Central Asia"…
$ pop <dbl> 38041757, 2854191, 43053054, 55312, 771…
$ Female <dbl> 68.98985, 82.05155, 77.60938, 74.38214,…
$ Male <dbl> 68.13812, 77.27016, 74.54654, 67.96911,…
Grampa Simpson (Matt Groening)


Start with the
lifeexpwide2023data,
map female life expectancy to the x-axis,
map male life expectancy to the y-axis,
represent each observation with a point,
and map region to the color of each point

Start with the
lifeexpwide2023data,
map female life expectancy to the x-axis,
map male life expectancy to the y-axis,
represent each observation with a point,
map region to the color of each point,
and title the plot “Life expectancy.”

Start with the
lifeexpwide2023data,
map female life expectancy to the x-axis,
map male life expectancy to the y-axis,
represent each observation with a point,
map region to the color of each point,
title the plot “Life expectancy,” and add the subtitle “2023.”

Start with the
lifeexpwide2023data, map female life expectancy to the x-axis, map male life expectancy to the y-axis, represent each observation with a point, map region to the color of each point, title the plot “Life expectancy,” add the subtitle “2023,” and refine x and y axis labels.

Start with the
lifeexpwide2023data, map female life expectancy to the x-axis, map male life expectancy to the y-axis, represent each observation with a point, map region to the color of each point, title the plot “Life expectancy,” add the subtitle “2023,” refine the axis labels, and fix the legend label.

Start with the
lifeexpwide2023data, map female life expectancy to the x-axis, map male life expectancy to the y-axis, represent each observation with a point, map region to the color of each point, title the plot “Life expectancy,” add the subtitle “2023,” refine the axis labels, fix the legend label, and add a caption for data source.

Tip
You can omit the names of the first two arguments when building plots with ggplot().
lifeexpwide2023 %>%
mutate(gap = Female - Male) %>%
select(location, worldbankregion, Female, Male, gap) %>%
arrange(desc(gap)) %>%
print(n = 10)# A tibble: 204 × 5
location worldbankregion Female Male gap
<chr> <chr> <dbl> <dbl> <dbl>
1 Ukraine Europe and Cen… 78.5 66.6 11.9
2 Palestine Middle East an… 72.0 60.7 11.3
3 Russian Federation Europe and Cen… 78.8 67.6 11.1
4 Mongolia East Asia and … 78.2 68.0 10.2
5 United States Virgin Islan… Latin America … 81.6 71.7 9.94
6 Latvia Europe and Cen… 80.6 70.7 9.91
7 Belarus Europe and Cen… 79.2 69.5 9.67
8 Lithuania Europe and Cen… 81.2 71.9 9.34
9 Georgia Europe and Cen… 79.4 70.1 9.32
10 Estonia Europe and Cen… 82.9 74.2 8.68
# ℹ 194 more rows
lifeexpwide2023 %>%
filter(Male > Female) %>%
mutate(gap = Male - Female) %>%
select(location, worldbankregion, Female, Male, gap) %>%
arrange(desc(gap))# A tibble: 4 × 5
location worldbankregion Female Male gap
<chr> <chr> <dbl> <dbl> <dbl>
1 United Arab Emirates Middle East and North … 79.6 80.2 0.594
2 Morocco Middle East and North … 72.8 73.3 0.524
3 Bhutan South Asia 72.4 72.9 0.462
4 Libya Middle East and North … 70.0 70.3 0.315
Commonly used characteristics of plotting characters that can be mapped to a specific variable in the data are:
colorshapesizealpha (transparency)Oops! Only 6 shapes are available, so this isn’t a good option for our more than 6 regions! Let’s fix that.

Oops! Only 6 shapes are available, so this isn’t a good option for our more than 6 regions! Let’s fix that.
Can also map to the same variable as color (helps for color vision deficiency)
aes().geom_*() (this was geom_point() in the previous example, but we’ll learn about other geoms soon!).facet_grid()
rows ~ cols. for no split.facet_wrap()