Openair R

Some ideas from openair R manual package: You can also create an interactive graph by making use of C3.js library. In this example you can interact with air pollutant data found in Martorell from 2005 to 2016. Data preparation
  • Name of Dates column must be dates
  • Convert dates into dates
>martorell$date<-as.Date(martorell$date, format=”%d/%m/%Y”, tz=”Europe/Madrid”) class (martorell$date) “Date”
  • Convert factor to numeric values:
cutData() selectByDate instruction: We can conclude that there is less pollution during weekends according to available hour data from H2S levels in the period 01/12/2016 to 30/11/2017.   AIR POLLUTION IN MARTORELL 2017 EXAMPLE
  1. SummaryPlot example
summaryPlot(martorell) date NO NO2 H2S “Date” “integer” “integer” “numeric”
2. Calendar plot example
Sys.setenv(LANG=”en”) >martorell<read.csv(file=”/Users/franciscoperezgarcia/Desktop/martorelld17.csv”) > View(martorelld17) > class(martorell$date) [1] “factor” > martorell$date<-as.Date(martorell$date, format=”%d/%m/%Y”) > class(martorell$date) [1] “Date” > library(openair) > calendarPlot(martorell,pollutant=”H2S”, year=”2017″)
  2. timePlot example
timePlot(martorell, pollutant=c(“NO”, “NO2″,”H2S”))
> timePlot(martorell,pollutant=”NO”, year=”2017″)
timePlot(martorell, pollutant = c(“NO”, “NO2”, “H2S”), + avg.time = “month”, normalise = “01/08/2017”, lwd = 4, lty = 1, + group = TRUE, ylim = c(0, 700))
3. monthPlot example
monthplot(martorell$NO2, main=expression(paste(“2017 Month plot of Martorell NO”[2])), ylab=”Conc (ug/m3)”)
4. timeVariation   5. Episodes of air pollution in Martorell Remember to convert ppb to microgram/m3 Pollution limits in other countries Concerning H2S: 8h over 1.5 microgram/m3 (1ppm), 15 min over 7.5 microgram/m3 (5 ppm) according to ACGIH, 2010 ALERT: Values of H2S are in microgram/m3 and limits in Catalonia are 40 (24-hour mean) and 100 (30-min mean). Review the previous code accordingly. Concerning NO2, criteria from EU Air Quality Standards and Air Quality Guidelines WHO 2011 limits Remember to calculate 8-hour mean of ozone and other means (1h,8h,24h, annual,etc) of other air pollutants to find air pollution episodes in your city. 6. trendLevel
trendLevel(martorellh, pollutant=”H2S”)
7. smoothTrend First, we choose to deseasonalise the data, then we choose to plot percentiles (the 5th, 50th, 75th and 95th) Times series ts

The best way to predict the future is to invent it (Alan Kay)