aqStats {openair}R Documentation

Calculate summary statistics for air pollution data by year

Description

Calculate a range of air pollution-relevant statistics by year.

Usage

aqStats(
  mydata,
  pollutant = "no2",
  type = "default",
  data.thresh = 0,
  percentile = c(95, 99),
  transpose = FALSE,
  ...
)

Arguments

mydata

A data frame containing a date field of hourly data.

pollutant

The name of a pollutant e.g. pollutant = c("o3", "pm10").

type

type allows timeAverage() to be applied to cases where there are groups of data that need to be split and the function applied to each group. The most common example is data with multiple sites identified with a column representing site name e.g. type = "site". More generally, type should be used where the date repeats for a particular grouping variable.

data.thresh

The data capture threshold in %. No values are calculated if data capture over the period of interest is less than this value. data.thresh is used for example in the calculation of daily mean values from hourly data. If there are less than data.thresh percentage of measurements available in a period, NA is returned.

percentile

Percentile values to calculate for each pollutant.

transpose

The default is to return a data frame with columns representing the statistics. If transpose = TRUE then the results have columns for each pollutant-site combination.

...

Other arguments, currently unused.

Details

This function calculates a range of common and air pollution-specific statistics from a data frame. The statistics are calculated on an annual basis and the input is assumed to be hourly data. The function can cope with several sites and years e.g. using type = "site". The user can control the output by setting transpose appropriately.

Note that the input data is assumed to be in mass units e.g. ug/m3 for all species except CO (mg/m3).

The following statistics are calculated:

For the rolling means, the user can supply the option align, which can be "centre" (default), "left" or "right". See rollingMean for more details.

There can be small discrepancies with the AURN due to the treatment of rounding data. The aqStats function does not round, whereas AURN data can be rounded at several stages during the calculations.

Author(s)

David Carslaw

Examples


## Statistics for 2004. NOTE! these data are in ppb/ppm so the
## example is for illustrative purposes only
aqStats(selectByDate(mydata, year = 2004), pollutant = "no2")



[Package openair version 2.18-2 Index]