I took a look at greenhouse gas emissions over the past few decades using data from the World Bank. I was interested to see specifically how the greenhouse gas emissions (thousand metric tons of CO2) in the United States compares with other countries. The data I look at is from 1960 - 2018. According to the World Bank: “Total greenhouse gas emissions in kt of CO2 equivalent are composed of CO2 totals excluding short-cycle biomass burning (such as agricultural waste burning and savanna burning) but including other biomass burning (such as forest fires, post-burn decay, peat fires and decay of drained peatlands), all anthropogenic CH4 sources, N2O sources and F-gases (HFCs, PFCs and SF6).”
# Import the data
ghg_emissions <- read_csv(file = 'total_greenhouse_gas_emissions.csv')
## Rows: 271 Columns: 18
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (18): Series Name, Series Code, Country Name, Country Code, 1960 [YR1960...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Rename the columns
names(ghg_emissions) <- c("Series Name","Series Code","Country Name", "Country Code", "1960", "1970","1980" , "1990", "2000", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018")
# Tidy the data
tidy_ghg_emissions <-
ghg_emissions %>%
gather('1960': '2018', key="year",
value="ghg_emissions")
tidy_ghg_emissions$ghg_emissions <- as.numeric(tidy_ghg_emissions$ghg_emissions)
tidy_ghg_emissions <- na.omit(tidy_ghg_emissions)
# View the data
print(tidy_ghg_emissions)
## # A tibble: 3,107 × 6
## `Series Name` `Series Code` `Country Name` `Country Code` year ghg_emissions
## <chr> <chr> <chr> <chr> <chr> <dbl>
## 1 Total greenh… EN.ATM.GHGT.… Afghanistan AFG 1970 14307.
## 2 Total greenh… EN.ATM.GHGT.… Albania ALB 1970 6961.
## 3 Total greenh… EN.ATM.GHGT.… Algeria DZA 1970 34604.
## 4 Total greenh… EN.ATM.GHGT.… American Samoa ASM 1970 13.1
## 5 Total greenh… EN.ATM.GHGT.… Angola AGO 1970 60649.
## 6 Total greenh… EN.ATM.GHGT.… Argentina ARG 1970 221957.
## 7 Total greenh… EN.ATM.GHGT.… Armenia ARM 1970 6246.
## 8 Total greenh… EN.ATM.GHGT.… Aruba ABW 1970 42.3
## 9 Total greenh… EN.ATM.GHGT.… Australia AUS 1970 319037.
## 10 Total greenh… EN.ATM.GHGT.… Austria AUT 1970 68415.
## # … with 3,097 more rows
# Use dplyr's summarize, count, and group_by functions
# max and and min greenhouse gas emissions (thousand metric tons of CO2) by year
group_ghg_emissions_year <- tidy_ghg_emissions %>%
group_by(year) %>%
summarise(max_ghg_emissions=max(ghg_emissions), min_ghg_emissions=min(ghg_emissions))
print(group_ghg_emissions_year)
## # A tibble: 13 × 3
## year max_ghg_emissions min_ghg_emissions
## <chr> <dbl> <dbl>
## 1 1970 27057172. 1.47
## 2 1980 32794096. 1.55
## 3 1990 29848570 20
## 4 2000 32781530 20
## 5 2010 41817500 20
## 6 2011 43022060 20
## 7 2012 43582450 20
## 8 2013 44233530 20
## 9 2014 44438190 20
## 10 2015 44423270 20
## 11 2016 44550150 30
## 12 2017 45117640 30
## 13 2018 45873850 30
# mean greenhouse gas emissions (thousand metric tons of CO2) by country
group_ghg_emissions_country <- tidy_ghg_emissions %>%
group_by(`Country Name`) %>%
summarise(mean_ghg_emissions=round(mean(ghg_emissions),2), count_of_emissions_reported=n())
print(group_ghg_emissions_country)
## # A tibble: 254 × 3
## `Country Name` mean_ghg_emissions count_of_emissions_reported
## <chr> <dbl> <int>
## 1 Afghanistan 59639. 13
## 2 Africa Eastern and Southern 1481550. 13
## 3 Africa Western and Central 729676. 13
## 4 Albania 9633. 13
## 5 Algeria 164144. 13
## 6 American Samoa 14.3 2
## 7 Andorra 579. 11
## 8 Angola 75513. 13
## 9 Antigua and Barbuda 951. 12
## 10 Arab World 1933687. 13
## # … with 244 more rows
# create subset of 5 countries: US, India, China, Sweden, Russia
subset_ghg <- tidy_ghg_emissions %>%
filter(tidy_ghg_emissions$`Country Code` %in% c("USA", "IND", "CHN", "SWE", "RUS"))
# Use ggplot2's functions to visualize insights.
# Plot Greenhouse Gas Emissions
subset_ghg %>%
ggplot( aes(x=year, y=ghg_emissions, group=`Country Code`, color=`Country Code`)) + geom_line() +
labs(y = 'Greenhouse Gas Emissions (thousand metric tons of CO2)') +
ggtitle(paste('Greenhouse Gas Emission Comparison (US, India, China, Sweden, Russia)'))
It is hard to come to any conclusions without knowing how the population compares in the countries all the way from 1960 - 2018. However, overall the US greenhouse gas emissions in thousand metric tons of CO2 is significantly higher than Sweden, Russia, and Russia. China greenhouse gas emissions are significantly higher than the emissions for the US. It is also interesting to note the sharp increase around 2000 in China while at that same time there appears to be a decrease for greenhouse gas emissions in the US.