Introduction

The purpose of this exploratory data analysis is to uncover relationships within the climate change dataset and visually demonstrate the disparities between high-impact countries and those most affected by climate change. It allowed us to build an intuition for wrangling the data which should allow us to make more powerful graphics in the rough draft. Something that I think needs more exploration is figuring out how to compare across 50+ categories.

Load Data

Introduction

This R Markdown document explores relationships within the climate change dataset. It aims to uncover insights regarding how countries’ activities and policies impact the environment, especially focusing on disparities between those contributing to climate change and those most affected by it.

Graphic 1: CO2 Emissions Per Capita by Country

# Filter for CO2 Emissions Per Capita in the selected year
co2 <- data %>% 
  filter(`Series name` == "CO2 emissions per capita (metric tons)") %>% 
  group_by(`Country name`) %>% 
  summarize(total = mean(Value, na.rm = TRUE)) %>%
  arrange(desc(total)) %>%
  top_n(10, total)  # Select top 10 countries

# Plot CO2 emissions per capita by country
ggplot(co2, aes(x = reorder(`Country name`, -total), y = total)) +
  geom_bar(stat="identity") +
  labs(title = "Top 10 Countries by CO2 Emissions Per Capita",
       x = "Country",
       y = "CO2 Emissions (metric tons per capita)") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

Commentary: This graphic shows the countries with the highest CO2 emissions per capita. We can observe patterns of growth or reduction and highlight disparities between countries.

Graphic 2: Population vs. CO2 Emissions

# Filter for Population and CO2 Emissions, then pivot data
pop_emissions_data <- data %>%
  filter(`Series code` %in% c("SP.POP.TOTL", "EN.ATM.CO2E.KT")) %>%
  select(`Country name`, Year, `Series code`, Value) %>%
  pivot_wider(names_from = `Series code`, values_from = Value, values_fill = NA)

# Display the first few rows to check alignment
head(pop_emissions_data, 10)
## # A tibble: 10 × 4
##    `Country name`        Year EN.ATM.CO2E.KT SP.POP.TOTL
##    <chr>                <dbl>          <dbl>       <dbl>
##  1 Aruba                 1990          1841.       62147
##  2 Afghanistan           1990          2677.    19023678
##  3 Angola                1990          4430.    10335052
##  4 Albania               1990          7488.     3289483
##  5 United Arab Emirates  1990         52009.     1808642
##  6 Argentina             1990        112614.    32642442
##  7 Antigua and Barbuda   1990           301.       62202
##  8 Australia             1990        287331.    17065100
##  9 Austria               1990         60960.     7710882
## 10 Burundi               1990           304.     5601720
# Plot Population vs CO2 Emissions
ggplot(pop_emissions_data, aes(x = `SP.POP.TOTL`, y = `EN.ATM.CO2E.KT`)) +
  geom_point(alpha = 0.5, color = "blue") +
  labs(
    title = "Population vs. CO2 Emissions",
    subtitle = "Relationship between Population and CO2 emissions across countries",
    x = "Population (total)",
    y = "Total CO2 Emissions (KtCO2)"
  ) +
  theme_minimal()
## Warning: Removed 897 rows containing missing values or values outside the scale range
## (`geom_point()`).

Commentary: This scatter plot illustrates the relationship between total population and CO2 emissions across countries, offering insights into how population size correlates with emissions.

The generated graph isn’t that compelling. I can’t tell if this is an issue with the code or the dataset (or both 😅) # Graphic 3: Population Growth vs. CO2 Emissions

# Filter for Population Growth and CO2 Emissions
population_emissions <- data %>%
  filter(`Series code` %in% c("SP.POP.GROW", "EN.ATM.CO2E.KT")) %>%
  select(`Country name`, Year, `Series code`, Value) %>%
  pivot_wider(names_from = `Series code`, values_from = Value, values_fill = NA)

# Plot Population Growth vs CO2 Emissions
ggplot(population_emissions, aes(x = `SP.POP.GROW`, y = `EN.ATM.CO2E.KT`)) +
  geom_smooth(color = "red") +
  labs(
    title = "Population Growth and CO2 Emissions",
    subtitle = "Relationship between population growth and CO2 emissions",
    x = "Population Growth (%)",
    y = "CO2 Emissions (KtCO2)"
  ) +
  theme_minimal()
## `geom_smooth()` using method = 'gam' and formula = 'y ~ s(x, bs = "cs")'
## Warning: Removed 911 rows containing non-finite outside the scale range
## (`stat_smooth()`).

Commentary: This plot shows the correlation between population growth rates and CO2 emissions, which may inform perspectives on how population dynamics affect emissions.

Graphic 4: CO2 Emissions per GDP

# Filter for CO2 Emissions per GDP
emissions_gdp <- data %>%
  filter(`Series code` == "EN.ATM.CO2E.PP.GD.KD") %>%
  filter(`Country name` %in% c("High income","Low income", "Middle income")) %>%
  select(`Country name`, Year, `Series code`, Value) %>%
  pivot_wider(names_from = `Series code`, values_from = Value, values_fill = NA)

# Plot CO2 Emissions per GDP
ggplot(emissions_gdp, aes(x = Year, y = `EN.ATM.CO2E.PP.GD.KD`, fill=`Country name`)) +
  geom_bar(stat = "identity", position = "dodge") +
  labs(
    title = "CO2 Emissions per Unit of GDP",
    subtitle = "CO2 emissions per GDP unit over time",
    x = "Year",
    y = "CO2 Emissions per GDP (kg/$1000 of 2005 PPP)"
  ) +
  scale_fill_brewer()+
  theme_minimal()

Commentary: This bar chart compares CO2 emissions relative to economic productivity, highlighting the efficiency of different countries’ economies in relation to emissions.

Graphic 5: Renewable Energy Target by Country

# Filter for Renewable Energy Target
renewable_energy <- data %>%
  filter(`Series code` == "EG.ELC.ACCS.ZS") %>%
  select(`Country name`, Year, Value) %>%
  filter(!is.na(Value))

# Plot Renewable Energy Targets by Country
ggplot(renewable_energy, aes(x = reorder(`Country name`, Value), y = Value)) +
  geom_col(fill = "darkgreen") +
  coord_flip() +
  labs(
    title = "Renewable Energy Targets by Country",
    subtitle = "Percentage of energy from renewable sources in 2020",
    x = "Country",
    y = "% Renewable Energy"
  ) +
  theme_minimal()

Commentary: This chart shows each country’s commitment to renewable energy, highlighting global efforts toward sustainable development.

Conclusion

These visualizations provide insights into the relationship between human activities and climate change across various countries. They emphasize the need for global cooperation and policy reform to mitigate environmental disparities.