Skip to contents

Function for importing common 1 hour average (hourly) UK Automatic Urban and Rural Network (AURN) Air Quality Archive data files previously downloaded in ".csv" format for use with the openair package. The function uses read.table (in utils) and rbind (in reshape).


  file = file.choose(), = 5, = 7,
  na.strings = c("No data", "", "NA"), = "Date",
  date.break = "-", = "time", = c(1, 2, 3, 4), = 4,
  bad.24 = TRUE,
  correct.time = -3600,
  output = "final",
  data.order = c("value", "status", "unit"),
  simplify.names = TRUE,



The name of the AURN file to be imported. Default, file.choose opens browser. Use of read.table (in utils) also allows this to be a readable text-mode connection or url (although these options are currently not fully tested).

The file row holding header information. This is used to set names for the resulting imported data frame, but may be subject to further modifications depending on following argument settings.

The first file row holding actual data. When generating the data frame, the function will ignore all information before this row, and attempt to include all data from this row onwards.


Strings of any terms that are to be interpreted as NA values within the file.

Header name of column holding date information. Combined with time information as single date column in the generated data frame.


The break character separating days, months and years in date information. For example, "-" in "01-01-2009".

Header name of column holding time information. Combined with date information as single date column in the generated data frame.

Row numbers of any additional information that may be required from the original file. Each line retained as a character vector in the generated data frame comment.

Header name of column holding site information. Setting to NULL turns this option off.


Reset AURN 24 time stamp. AURN time series are logged as 00:00:01 to 24:00:00 as opposed to the more conventional 00:00:00 to 23:59:59. bad.24 = TRUE resets the time stamp which is not allowed in some time series classes or functions.


Numerical correction (in seconds) for imported date. AURN data is logged retrospectively. For 1 hour average data, correct.time = -3600 resets this to the start of the sampling period.


Output style. Default "final" using import().


A vector of names defining the order of data types. AURN files typically include three data types, actual data and associated data quality and measurement unit reports. Here, these are defined as "value", "status" and "unit", respectively.


A logical (default TRUE) prompting the function to try to simply data frame names using common chemical shorthand. FALSE retains names from original file, although these may be modified if they contain unallowed characters or non-unique names.


Other parameters. Passed onto and handled by import().


The function returns a data frame for use in openair. By comparison to the original file, the resulting data frame is modified as follows: Time and date information will combined in a single column "date", formatted as a conventional timeseries (as.POSIXct). Time adjustments may also be made, subject to "bad.24" and "correct.time" argument settings. Using default settings, the argument

correct.time = - 3600 resets the time stamp to the start of the measurement period. If name simplification was requested (simplify.names = TRUE), common chemical names will be simplified. For example, "carbon monoxide" will be reset to "co". Currently, this option only applies to inorganics and particulates, not organics. Non-value information will be rationalised according to data.order. For example, for the default, data.order = c("value", "status", "unit"), the status and unit columns following the "co" column will be automatically renamed "" and "", respectively. An additional "site" column will be generated. Multiple "site" files are allowed. Additional information (as defined in "") and data adjustments (as defined by "bad.24" and "correct.time") are retained in the data frame comment.


The importAURN() function was developed for use with air quality monitoring site data files downloaded in standard hourly (or 1 hour average) format using the Air Quality Archive email service. Argument defaults are set to common values to simplify both the import operation and use with openair.

Similar file structures can also be imported using this function with argument modification.

See also

Generic import function import, or direct (on-line) data import function importAURN. Other dedicated import functions available for other file types, e.g.: importKCL, importADMS, etc.


Karl Ropkins


#example 1
#example using data from url

#import data as otherdata
## otherdata <- importAURNCsv(
##  "")

#use openair function
## summarise(otherdata)

#example 2
#example of importing other similar data formats

#import 15 min average so2 data from Bexley using url
## <- importAURNCsv(
##  "",
##  correct.time = -900)

#note: correct.time amended for 15 min offset/correction.

#additional comments
## comment(

## diurnal.error(, pollutant="so2")

#wrapper for above operation
##(e.g. if you have to do this -or similar- a lot of time)
## my.import.wrapper <- function(file, correct.time = -900, ...)
##  { importAURNCsv(file = file, correct.time = correct.time, ...) }

#same as above
## <- my.import.wrapper(
##  "")

## timeVariation(, pollutant="so2")