Learn R Programming

openair (version 0.4-23)

aqStats: Calculate summary statistics for air pollution data by year

Description

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

Usage

aqStats(mydata, pollutant = "no2", data.thresh = 75, 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").
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 a
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.

Warning

Note that no rounding of the data is undertaken in the calculations. For this reason there may occasionally be some difference compared with statistics available through the AURN.

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. 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:
  • data.capture--- percentage data capture over a full year.
  • mean--- annual mean.
  • minimum--- minimum hourly value.
  • maximum--- maximum hourly value.
  • median--- median value.
  • max.daily--- maximum daily mean.
  • max.rolling.8--- maximum 8-hour rolling mean.
  • max.rolling.24--- maximum 24-hour rolling mean.
  • percentile.95--- 95th percentile. Note that several percentiles can be calculated.
  • roll.8.O3.gt.100--- number of days when the daily maximum rolling 8-hour mean ozone concentration is >100 ug/m3.
  • hours.gt.200--- number of hours NO2 is more than 200 ug/m3.
  • days.gt.50--- number of days PM10 is more than 50 ug/m3.

Examples

Run this code
## Statistics for 2004. NOTE! these data are in ppb/ppm so the
## example is for illustrative purposes only
aqStats(selectByDate(mydata, year = 2004), pollu=c("no2", "pm10"))
## transpose the results:
aqStats(selectByDate(mydata, year = 2004), pollu=c("no2", "pm10"),
transpose = TRUE)

Run the code above in your browser using DataLab