For the purpose of comparison with STL decomposition we showcase the elimination of a linear trend and seasonal effects on carbon dioxide (CO2) data taken at the Mauna Loa Observatory in Hawaii

First, we load the Keeling Curve. The data is provided by Dr. Pieter Tans, NOAA/ESRL and Dr. Ralph Keeling, Scripps Institution of Oceanography. Revisit the section on data sets used to remind yourself how to download and extract the data set of interest.

library(xts)
load(url("https://userpage.fu-berlin.de/soga/data/r-data/KeelingCurve.Rdata"))

For the purpose of demonstration we focus on the period from 1990 to 2015. We subset the time series by applying the window() function.

Exercise: Subset the co2 data set to the period 1990-2015 using the window() function.

## Your code here...
co2_1990_2015 <- NULL
Show code
co2_1990_2015 <- window(co2,
  start = "1990-01-01",
  end = "2015-12-31"
)
plot(co2_1990_2015,
  type = "o",
  cex = 0.5,
  ylab = expression("CO"[2] * " ppm"),
  main = expression("CO"[2] * " Concentration at Mauna Loa Observatory, Hawaii (1990-2015)"),
  cex.main = 0.85
)

Finally, we store the time series data set in a .RData file for further processing.

save(file = "KeelingCurve_1990-2015.RData", co2_1990_2015)

Citation

The E-Learning project SOGA-R was developed at the Department of Earth Sciences by Kai Hartmann, Joachim Krois and Annette Rudolph. You can reach us via mail by soga[at]zedat.fu-berlin.de.

Creative Commons License
You may use this project freely under the Creative Commons Attribution-ShareAlike 4.0 International License.

Please cite as follow: Hartmann, K., Krois, J., Rudolph, A. (2023): Statistics and Geodata Analysis using R (SOGA-R). Department of Earth Sciences, Freie Universitaet Berlin.