For this assignment, I selected Greenhouse gases database. The dataset includes greenhouse gas concentrations Carbon dioxide(CO₂), Methane (CH₄), and Nitrous oxide (N₂O), measured over a 2000-year period. The data is useful for studying long-term environmental trends which include volumes of greenhouse gases in the atmosphere that have negative impact on climate change. Concentrations of these three greenhouse gases are measured in volume (CO2) by ppm, (CH4) and (N2O) by ppb and the measurements are provided every 20 years the the Law Dome Ice Core in Antarctica. Source:Source: MacFarling Meure et al. 2006 via NOAA.
Load the tidyverse and dslabs packages, to view lists of all datasets available to explore before diving into specific analyses.
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.5
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.5.2 ✔ tibble 3.2.1
✔ lubridate 1.9.4 ✔ tidyr 1.3.1
✔ purrr 1.0.4
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
ggplot(greenhouse_gases, aes(x = year, y = concentration,)) +geom_point( aes(colour = gas, alpha =0.5, size =0.2)) +stat_smooth(aes(color = gas), method ="lm",formula = y ~poly(x, 2), se =FALSE) +scale_fill_brewer(palette ="Set1") +scale_x_continuous(limits =c(1700, 2000)) +geom_vline(xintercept =1760, linetype ="dashed", color ="blue") +labs(title ="Greenhouse gas concentrations over 2000 years, (1700-2000)",x ="Year",y ="Volume Concentration (CH4,CO2,N2O)",caption ="Source: MacFarling Meure et al. 2006 via NOAA") +theme_economist()
Warning: Removed 252 rows containing non-finite outside the scale range
(`stat_smooth()`).
Warning: Removed 252 rows containing missing values or values outside the scale range
(`geom_point()`).
Second plot
ggplot(greenhouse_gases, aes(x = year, y = concentration, fill = gas)) +geom_area(alpha =0.8) +scale_fill_brewer(palette ="Set2") +scale_linewidth_binned() +labs(title ="Greenhouse gas concentrations over 2000 years",y ="Volume Concentration (CH4,CO2,N2O)",caption ="Source: MacFarling Meure et al. 2006 via NOAA") +theme_economist(6)
Summary: The graph indicates a steady rise in CO₂, CH₄, and N₂O levels, with a notable increase beginning in the early 1800s. This shift aligns closely with the onset of the Industrial Revolution marked with a dashed line in 1760 indicating a pivotal moment when human activity such as burning fossil fuels and agricultural activities which significantly increased air pollution. For instance, the methane (CH₄) shows the steepest line curve which is likely driven by livestock and modern farming methods. While the data visualized doesn’t prove direct causation, the long-term pattern is noticeable. However, the substantial increase in these gases indicates that human activities may have contributed to climate change over the past three centuries. If these trajectories continue, CH₄ could become an even more dominant pollutant, accelerating global warming due to its high heat-trapping potential. Continued CO₂ buildup will prolong warming for centuries, impacting ecosystems, sea levels, and extreme weather conditions. The compounding effect of all three gases signals a critical need for policy interventions, technological innovation, and collective global action to curb emissions.