Pulling in Data and Cleaning:

#Pull it in
library(tidyverse)
setwd("C:\\Users\\19717\\OneDrive\\Willamette\\Data Viz\\0_final_project")
corrupt = read.csv("ti-corruption-perception-index.csv")
life_exp=read_csv("Life_Expectancy_Data.csv")

#pull in ggtext
library(ggtext)

#this makes it run for Amaya
#corrupt = read.csv("C://Users//amaya//Downloads//data_viz_data//ti-corruption-perception-index//ti-corruption-perception-index.csv")
#life_exp=read_csv("C://Users//amaya//Downloads//data_viz_data//archive//Life_Expectancy_Data.csv")

#Clean it
life_exp=life_exp%>%mutate(composite=paste(Country,Year,sep="-"))
corrupt=corrupt%>%mutate(composite=paste(Entity,Year,sep="-"))
full_data=full_join(life_exp, corrupt, by=c("composite", "Year"))
ds=full_data%>%select(c(Year,Measles,Country))

Intro:

Across the world, the health of a nation is more than just life expectancy or disease rates–it reflects how much people trust their systems, how effectively governments deliver care, and whether communities feel supported. Today, we examine how health outcomes, corruption perception, and national development are deeply interconnected–and more importantly, how targeted public health investments can strengthen all three. Our goal is to show that improving health is not just a medical priority; it is a strategy for building public trust, national pride, and long-term development.

Global Human Development Insights:

## PULLING PACKAGES 
setwd("C:\\Users\\19717\\OneDrive\\Willamette\\Data Viz\\images")
library("rnaturalearth")
library("rnaturalearthdata")
library("magick")
world=ne_countries(scale="medium",returnclass="sf")

## LOOP
for(i in 2000:2014){
    life_i=life_exp%>%filter(Year==i)
    world_i=left_join(world,life_i,by=c("name_en"="Country"))
    #make the plot
    world_i %>% ggplot(aes(fill=`Income composition of resources`)) +
      geom_sf()+
      scale_fill_viridis_c(na.value="white", name="HDI",breaks=c(0,0.25,0.5,0.75,1),labels=c("0 (Low)",".25",".5",".75","1 (High)"),limits=c(0,1))+
      theme_void()+
      theme(panel.background=element_rect(fill="white"),
            plot.background=element_rect(fill="white"))+
      labs(title = paste("Global Development Is Closely Tied to Health and Well-Being: \nGlobal Human Development in",i),
           subtitle = "Human Development Index (HDI), combining health, education, and income (2012–2015)") +
      labs(fill = "HDI",caption = "source: https://www.kaggle.com/datasets/burakergene/life-expectancy")
    #save it
    ggsave(paste("GORE_",i,".png",sep=""))
}    
## set directory
setwd("C:\\Users\\19717\\OneDrive\\Willamette\\Data Viz\\images")
png_directory="C:\\Users\\19717\\OneDrive\\Willamette\\Data Viz\\images"
imgs = list.files(png_directory, full.names = TRUE)

## read in all images in the imgs folder:
img_list = lapply(imgs, image_read)

## join the images together:
img_joined = image_join(img_list)

## animate at 2 frames per second:
img_animated = image_animate(img_joined, fps = 1)

## view animated image:
img_animated

image_write(image = img_animated, path = "maps2.gif")

We can see that health, education, and income–the things calculated in the Human Development Index–are important and vary greatly between countries and continents, with some increasing little by little over time.

Corruption Perception Index Insights:

Public Trust and Development Rise Together

Average Corruption Perceptions Index (CPI) by continent, 2012–2024

#pulling in library
library(plotly)

#clean
corruptds=full_data%>%select(Year,Country, `Corruption.Perceptions.Index`,`World.region.according.to.OWID`)

corruptds=corruptds%>%filter(!is.na(`World.region.according.to.OWID`))

corruptds$`World Region` = corruptds$World.region.according.to.OWID

small=corruptds%>%group_by(`World Region`,Year)%>%summarize(`Corruption Value`=mean(`Corruption.Perceptions.Index`))

#plot
p=ggplot(small)+
  annotate("rect",xmin=2012,xmax=2024,ymin=70,ymax=50,fill="grey90",alpha=.4)+
  geom_line(aes(color=`World Region`,y=`Corruption Value`,x=Year),linewidth=1.5)+
  scale_y_reverse()+
  xlim(2012,2024) +
  labs(
       subtitle = "Corruption Perception Index (CPI): Higher scores indicate lower perceived corruption",
       y = "Average Corruption Perceptions Index (CPI Score)")+
  theme_minimal() +
  labs(color = "Continent")+
  annotate("text",x=2020,y=65,label="These two continents are <br> <b>less corrupt than average</b>",size=3, fill=NA,label.color=NA) +
  annotate("text", x = 2024.75, y = 58, label = "Europe", size = 4, color = "#7ab350") +
  annotate("text", x = 2024.85, y = 56, label = "Oceania", size = 4, color = "#7ba0f7") +
  annotate("text", x = 2024.85, y = 45, label = "North \nAmerica", size = 4, color = "#83b9bf") +
  annotate("text", x = 2024.5, y = 40, label = "Asia", size = 4, color = "#b5916b") +
  annotate("text", x = 2024.85, y = 36.5, label = "South \nAmerica", size = 4, color = "#ca82cf") +
  annotate("text", x = 2024.60, y = 32, label = "Africa", size = 4, color = "#e08275") +
  scale_x_continuous(limits=c(NA,2026))

#don't show the legend.
ggplotly(p)%>%hide_legend()

The CPI measures how citizens and experts perceive corruption in the public sector. While not a direct measure of corruption, it reflects trust in institutions, which is an essential foundation for effective public health systems.

We see that there are some countries that are less corrupt on average and fall within the grey box. It is perhaps not all that surprising that Africa is the most corrupt, as it was also among the least developed in the human development map.

One interesting note here is that North America experienced an abrupt peak in 2015. This could be attributed to many things, including depreciation of the Mexican Peso and Canadian Dollar, the La Casa Blanca scandal in the Mexican government, and the kidnapping and disappearance of 43 students. These events highlighted collaboration and corruption among gangs and the government, and where money is being allocated.

While we know that corruption and development are important for a country, what does this have to do with actual health outcomes within countries?

Body Mass Index Insights:

#libraries
library(ggtext)

#cleaning
full_data1=full_data%>%filter(BMI>=28)
full_data2=full_data%>%filter(BMI<28)

#plot
ggplot()+
  geom_histogram(data=full_data1,aes(y=BMI),fill="blue4",alpha=0.4,bins=14)+
  geom_histogram(data=full_data2,aes(y=BMI),fill="goldenrod",alpha=0.4,bins=14)+
  geom_hline(yintercept=28, color='black',linewidth=.7,linetype="dashed") +
  #making a line where the US lies in terms of percentage of adults overweight
  labs(title = "Nutritional Inequality Reveals Hidden Health Risks",
       subtitle = "Distribution of adult overweight prevalence (BMI ≥ 25) across countries", 
       y = "Percentage of Adults Overweight",
       x = "Number of Countries",
       caption = "source: https://www.kaggle.com/datasets/burakergene/life-expectancy") +
  theme_minimal()+
  annotate("richtext",x=200,y=35,label="This line indicates where <br> the **U.S.** lies in terms of <br> **percentage of overweight adults**",fill=NA,label.color=NA,size=3) +
  theme(panel.grid.minor.y = element_blank(),
        panel.grid.major.y=element_blank(),
        panel.grid.minor.x = element_blank()) +
  theme(plot.subtitle = element_markdown())+
  scale_x_continuous(breaks=c(0,50,150,250))+
  scale_y_continuous(breaks=c(0,40,80))

This distribution shows that many countries exceed even the U.S. in overweight prevalence. This doesn’t simply reflect excess; it often signals poor nutrition quality, limited access to healthy foods, and systemic health inequalities. Poor food access is notably not a quantity issue, but often a structural, macroeconomic issue which can be solved through global financial support and resource allocation.

These patterns highlight how structural factors shape health. But when countries intervene intentionally, these outcomes can change dramatically.

Case Study Insights:

#cleaning
target=c("Australia", "Romania", "Sweden", "Uzbekistan", "Tajikistan", "Luxembourg")
target2=c(2012,2014)

#filtering in here for country and target years
ds=full_data
ds1=ds%>%filter(Country %in% target, Year %in% target2)
ds2=ds1%>%select(Country,Year, Measles, `Hepatitis B`,Polio,Diphtheria)

temp=ds2%>%group_by(Country,Year)%>%summarize(tot=sum(Measles, `Hepatitis B`,Polio,Diphtheria))

temp$Year=as.integer(temp$Year)

temp1=temp%>%filter(Country!="Romania")

temp2=temp%>%filter(Country=="Romania")

#plotting
ggplot()+
geom_col(data=temp1,aes(y=Country,x=tot),fill="grey80")+
facet_wrap(~Year)+
geom_col(data=temp2, aes(y=Country,x=tot),fill="blue")+
  theme_minimal()+
  labs(title="Targeted Public Health Investment Can Rapidly Improve Outcomes",
       subtitle="Reduction in infectious disease cases (2012–2014): <br> Romania compared to high- and low-GDP countries",
       x="Total Number of Cases",
       #y="Country",
       caption="source: https://www.kaggle.com/datasets/burakergene/life-expectancy") +
  theme(panel.grid.major.y = element_blank(), 
        plot.title = element_markdown(),
        plot.subtitle = element_markdown(),
        axis.title.y=element_blank(),
        panel.grid.minor.x=element_blank(),
        margins = margin(l=0.2,r=0.2)
  ) +
  xlim(-0.0001,8005)

Romania provides a clear example of what is possible. Through targeted vaccination campaigns, improved healthcare delivery, and better healthcare funding, the country reduced disease cases dramatically in just two years.

This demonstrates that strategic investment (especially when targeted) can transform health outcomes regardless of starting point.

Conclusion:

The evidence across these visualizations tells a consistent story: Health, development, and public trust are not separate challenges; they are interconnected systems. Countries that invest in targeted public health strategies (such as vaccination campaigns, nutrition access, and equitable healthcare infrastructure) not only improve health outcomes but also strengthen institutional trust and national development. For global leaders and organizations like the United Nations, this presents a clear opportunity: by prioritizing health-focused communication and targeted interventions in vulnerable populations, we can help nations build trust, improve quality of life, and create a sustainable cycle of growth and well-being.

Health investment builds trust, trust enables development, and development sustains healthier populations.

Sources: