In this lesson, we will compare procedural and declarative approaches to computing aggregate values (mean, maximum value) from time series of concentrations at a single site.

In general, you will find that an R script often follows a set of common operations:

  1. import libraries
  2. define additional functions
  3. import data
  4. apply manipulations
  5. export figures, text files

Import libraries and define options

Load libraries

library(dplyr)
library(reshape2)
library(chron)
library(ggplot2)
source("GRB001.R")

Define options

Sys.setlocale("LC_TIME","C")
## [1] "C"
options(stringsAsFactors=FALSE)
options(chron.year.abb=FALSE)
theme_set(theme_bw()) # just my preference for plots

Start working with data

The data is available from the National Air Pollution Monitoring Network (NABEL) of Switzerland.