Learn R Programming

openair (version 2.7-2)

importAQE: Air Quality England Network data import for openair

Description

Function for importing hourly mean Air Quality England (AQE) archive data files for use with the openair package. Files are imported from a remote server operated by Ricardo that provides air quality data files as R data objects.

Usage

importAQE(
  site = "yk13",
  year = 2018,
  pollutant = "all",
  meta = FALSE,
  to_narrow = FALSE
)

Arguments

site

Site code of the AQE site to import e.g. "yk13" is York Heworth Green. Several sites can be imported with site = c("yk13", "yk16") --- to import York Heworth Green and York Fulford Road Roadside for example.

year

Year or years to import. To import a sequence of years from 1990 to 2000 use year = 1990:2000. To import several specific years use year = c(1990, 1995, 2000) for example.

pollutant

Pollutants to import. If omitted will import all pollutants from a site. To import only NOx and NO2 for example use pollutant = c("nox", "no2").

meta

Should meta data be returned? If TRUE the site type, latitude and longitude are returned.

to_narrow

By default the returned data has a column for each pollutant/variable. When to_narrow = TRUE the data are stacked into a narrow format with a column identifying the pollutant name.

Value

Returns a data frame of hourly mean values with date in POSIXct class and time zone GMT.

Details

The importAQE function has been written to make it easy to import data from the Air Quality England (AQE) --- https://www.airqualityengland.co.uk/. Ricardo have provided .RData files (R workspaces) of all individual sites and years for the AQE. These files are updated on a daily basis. This approach requires a link to the Internet to work.

For a list of up to date site codes and site information, see importMeta and in particular importMeta(source = "aqe").

The site codes and pollutant names can be upper or lower case. The function will issue a warning when data less than six months old is downloaded, which may not be ratified.

See Also

See family of air quality neiwork import functions including importAURN for data elsewhere in the UK and importKCL for importing comprehensive data in and around London.

Examples

Run this code
# NOT RUN {
## see what sites are available
# }
# NOT RUN {
meta <- importMeta("aqe")
# }
# NOT RUN {
## import all pollutants from York Fulford Road
# }
# NOT RUN {
yk16 <- importAQE(site = "yk16", year = 2010:2018)
# }
# NOT RUN {
## return meta data also
# }
# NOT RUN {
yk16 <- importAQE(site = "yk16", year = 2018, meta = TRUE)
# }
# NOT RUN {
## import all pollutants from two sites for 2018
# }
# NOT RUN {
all <- importAQE(site = c("yk13", "yk16"), year = 2018)
# }
# NOT RUN {

# }

Run the code above in your browser using DataLab