Tools: Tableau and R β equally Dataset: World Indicators (World Bank data)
π¨ Critical Reminder π¨
This Course Is NOT About Learning Software
This course teaches you to THINK about visualizations, not just use tools.
How to choose the right chart for your story
How to design effective, readable graphics
How to communicate with data
The tool is just that β a TOOL.
Learn it through practice, trial and error, and experimentation.
The Dataset: World Indicators
Same data, two tools:
Tableau β built-in World Indicators sample workbook
R β wbstats package, pulling live from the World Bank API
Both draw from the same source: World Bank open data
Country-level indicators from the 1960s to the present
Health Β· Economics Β· Demographics Β· Environment Β· Technology
Your First Decision: Pick a Focus
Choose ONE region OR one theme β and stick with it.
By Region πΊοΈ
Latin America & Caribbean
Sub-Saharan Africa
East Asia & Pacific
Europe & Central Asia
South Asia
By Theme π
π Health
π° Economic Development
πΏ Environment
π Technology & Connectivity
π₯ Demographics
Write your choice at the top of your submission.
Accessing the Data in Tableau
Open Tableau Desktop
From the Start screen β Sample Workbooks β World Indicators
OR: Connect β Saved Data Sources β World Indicators.tds
Explore the Data Source tab before building anything
Tip
Key fields to know: Country / Region, Year, Life Expectancy at Birth, GDP per Capita, CO2 Emissions, Fertility Rate, Internet Users %, Population Total
Accessing the Data in R
install.packages("wbstats") # run oncelibrary(wbstats)library(dplyr)library(ggplot2)# Search for indicator codeswb_search("life expectancy")wb_search("GDP per capita")# Download your datadata <-wb_data(indicator =c(life_exp ="SP.DYN.LE00.IN", # Life expectancygdp_pc ="NY.GDP.PCAP.CD", # GDP per capitafertility ="SP.DYN.TFRT.IN", # Fertility rateco2 ="EN.ATM.CO2E.PC", # CO2 per capitainternet ="IT.NET.USER.ZS", # Internet users (%)pop ="SP.POP.TOTL"# Population ),country =c("CRI", "BRA", "MEX", "CHL", "COL"), # ISO3 codesstart_date =1990,end_date =2022)
# Find ISO3 codes for your regionwb_countries() |>select(iso3c, country, region) |>filter(region =="Latin America & Caribbean")
Lab Structure
Complete at least 3 of 5 tasks.
Task
Focus
1
Basic time series line graph
2
Add a trend line
3
Scatter plot β two indicators
4
Multiple series: overlay vs. small multiples
5
Annotated visualization β tell a story
Quality over quantity. Depth over breadth.
Task 1 & 2: Time Series + Trend Lines
Task 1: Line graph of one indicator over time for your countries Task 2: Add a trend line β try at least two model types
In Tableau:
Year β Columns, measure β Rows, Country β Color
Analytics pane β drag Trend Line β try linear vs. polynomial
In R:
ggplot(data, aes(x = date, y = life_exp, color = country)) +geom_line(linewidth =1) +geom_smooth(method ="lm", se =TRUE) +# swap for method = "loess"labs(title ="Life Expectancy Over Time",x =NULL, y ="Life Expectancy (years)", color =NULL) +theme_minimal()
Tip
Try span = 0.3 vs. span = 0.7 with LOESS β what changes?
Task 3: Scatter Plot β Two Indicators
The classic Gapminder view: relationship between two indicators for one year
In Tableau:
One indicator β Columns, another β Rows, mark type β Circle
Population Total β Size, Country β Label
Filter to a single year; try Pages to animate across years
In R:
data_2019 <- data |>filter(date ==2019)ggplot(data_2019, aes(x = gdp_pc, y = life_exp, size = pop, label = country)) +geom_point(alpha =0.6, color ="steelblue") +geom_text(size =2.5, vjust =-0.8, check_overlap =TRUE) +scale_x_log10(labels = scales::label_dollar(suffix ="K", scale =1/1000)) +scale_size_continuous(range =c(2, 14), guide ="none") +labs(title ="GDP per Capita vs. Life Expectancy (2019)",x ="GDP per Capita (log scale)", y ="Life Expectancy (years)") +theme_minimal()
Task 4: Overlay vs. Small Multiples
Same data, two layouts β which works better?
Overlay
All countries on one plot
Color = country
Good for: direct comparison of levels
ggplot(data, aes(x = date, y = life_exp, color = country)) +geom_line(linewidth =1) +scale_color_brewer(palette ="Set2") +theme_minimal()
The goal is to think carefully about how to visualize change over time and relationships between variables β and to develop your own sense of when each tool serves you better.