knitr::opts_chunk$set(echo = TRUE)
library(dplyr)
library(londonair)

This package provides tools to download air quality data for London.

Installation

To install londonair from github you need to use the devtools package.

If you do not have devtools installed, you will need to run the commented out line of code as well.

#install.packages("devtools")
devtools::install_github("LiRogers/londonair")
library(londonair)

Package functions

londonair contains functions that fetch meta data and monitoring data for air quality monitoring sites across the whole of London, or for the 3 main sensor networks, the London Air Quality Network (LAQN), Breathe London, and the Air Quality England (AQE) network.

Site meta data

Meta data can be fetched as follows:

meta_data <- getMetaLondon()

meta_data %>%
  head()

This gets meta data for all air quality monitoring sites across London. The equivalent functions for the 3 networks are getMetaLAQN(), getMetaBreathe() and getMetaAQE().

Monitoring data

Hourly monitoring data can be fetched as follows:

# For all sites and species:
df <- importLondon(start_date = as.Date('2019-01-01'),
                      end_date = as.Date('2019-01-07'))

# For specified sites and species:
df <- importLondon(start_date = as.Date('2019-01-01'),
                      end_date = as.Date('2019-01-07'),
                      sites = c("BG1", "WL1", "MY1"),
                      species = c("NO2", "PM10", "PM25"))

# Providing meta data - this will speed up your code if you're making multiple calls to importLondon
meta_data <- getMetaLondon()
df <- importLondon(start_date = as.Date('2019-01-01'),
                      end_date = as.Date('2019-01-07'),
                      sites = c("BG1", "WL1", "MY1"),
                      species = c("NO2", "PM10", "PM25"),
                      meta_data = meta_data)

df %>% 
  head()

This will work for sites in both networks. To fetch the data from just one of the networks the equivalent functions are importLAQN(), importBreathe() and importAQE(), which have the same parameters as importLondon().

The format of the monitoring data returned will work with the utility functions included in the OpenAir R package.



LiRogers/londonair documentation built on Nov. 15, 2019, 5:25 a.m.