Global Warming - CO2
This project is about plotting yourself some of the key parameters of the climate change we are (will be) experiencing.
Those squared questions are optional
Climate change
Definition
First of all, we need to be clear on the difference between climate and weather.
Check online what is this difference and why climate has little to do with is the afternoon going to be sunny and/or windy.
Atmospheric carbon dioxide
Carbon dioxide, CO2 is as its name says, an oxide. Meaning, once in the atmosphere is it extremely stable and will remain there for thousands of years. Two main carbon sinks exist: forest, mainly trees that incorporate the carbon for their growth and oceans. The latter have absorbed approximately half of what humans have produce by burning oil, not without consequences. Oceans are getting warmer, making CO2 solubility weaker and diminishes the pH. This acidification already killed half of the animals building coral reef and calcifying organisms. CO2, like methane is a greenhouse gas, absorbing and radiating infrared thermal energy leading to heat being trapped close to the ground. It is worth saying that the first scientist to discover the link between CO2 and heat trap was a woman Eunice Newton Foote as early as 1856. French version of the Wikipedia page is more in line with the Smithsonian article: she was not allowed to present her work because of her gender.
We will now look at the CO2 concentration in the Earth’ atmosphere over the last 800 KYr based on a study published in 2015
The CO2 concentration was determined from ice cores from Antarctica and the dataset is available here at NOAA. A saved copy is available here.
Read in the dataset. Assign to the name ice_core_CO2
Pay attention to specify which lines are comments. Otherwise, let {readr} guess the delimiter.
This dataset has the date in the column age_gas_calBP. What is the range of this time frame in the unit calBP?
The most recent date is then year -51.03 in calBP, from wikipedia we learn that the present is set to 1950.
After rounding to the closest integer the age_gas_calBP convert it to common years. Assign to the same name ice_core_CO2 to save this new column year.
Mind to change the sign! As the age was positive values for old times.
Plot the carbon dioxide concentration in ppm per year and comment
Read into R the file CO2 annual means by NOAA that
provide CO2 ppm from 1959 to 2023 measured at Mauna Loa (Hawaii). Save as hawaii_CO2
This file a fixed-width file. Each column has a fixed width but read_table() will read it correctly when the header is specified. For example c("year", "co2_ppm", "unc")) is relevant.
watch out to specify that lines with a ‘#’ are comments
Bind the rows of of the Hawaii and Antarctica tibbles for the columns year and co2_ppm. Save as CO2
How many year have more than one co2_ppm? And why we have them?
Summarise by the mean and standard deviation sd() the multiple values per year. Save as CO2_year
We still have one year which is a missing value, get rid of it at this stage. The standard deviation is going to be NA when we have one value per year. After the summarise, please replace all those NA, by 0.
Plot the CO2 atmospheric concentration by year with a line and comment
Redo the same plot but only for the year 1000 to 2020.
Since we have the error associated to your mean approximation, we can add it to this plot with an additional layer ribbon:
geom_ribbon(aes(x = year, ymin = mean_co2_ppm - sd_co2_ppm, ymax = mean_co2_ppm + sd_co2_ppm))Do you think the measurements from either Hawaii or Antartica differ much for the period they overlap?
Do you see any effect on the CO2 concentration since international agreements were signed?
In case you would not be convinced by the greenhouse effect of CO2, you can look at correlation between CO2 and temperatures over a longer period below:

Cumulative carbon dioxide emissions
Due to extreme long time CO2 remains in the atmosphere, looking at yearly emissions is of little interest. Especially since this is used by rich countries who got rid of most of their industry to justify little efforts. What matters is the cumulative emissions.
Let’s explore with another dataset from the famous Our World in Data organisation
Download and open the CSV CO2 file, assign name owid_co2
This file comes already in a data format you can use straight away. But there are missing values in columns, so pay attention to use the argument na.rm = TRUE in your sums.
Using the co2 column, sum up per year the cumulative emission of carbon dioxide and find out when 50% of emissions were produced
Select directly the “World” as country and the cumulative CO2 are also already computed in cumulative_co2
Display the top 10 Carbon dioxide countries emitters of all time and comment
The Our World in Data added the calculations for continents and world inside country. to select only individual countries, select only iso_code that are 3 characters long.