Learn R Programming

AirMonitor (version 0.4.2)

aqiCategories: Generate AQI categories

Description

This function converts hourly PM2.5 measurements into AQI category levels. These levels can then be converted to colors or names using the arrays found in US_AQI.

Usage

aqiCategories(
  x,
  pollutant = c("PM2.5", "AQI", "CO", "NO", "OZONE", "PM10", "SO2"),
  NAAQS = c("PM2.5_2024", "PM2.5"),
  conversionArray = NULL
)

Value

A vector or matrix of AQI category indices in the range 1:6.

Arguments

x

Vector or matrix of PM2.5 values or an mts_monitor object.

pollutant

EPA AQS criteria pollutant.

NAAQS

Version of NAAQS levels to use. See Note.

conversionArray

Array of six text or other values to return instead of integers.

Details

By default, return values will be integers in the range 1:6 or NA. The conversionArray parameter can be used to convert these integers into whatever is specified in the first six elements of conversionArray. A typical usage would be: conversionArray = US_AQI$names_eng.

See Also

aqiColors

Examples

Run this code
library(AirMonitor)

# Lane County, Oregon AQSIDs all begin with "41039"
LaneCounty <-
  NW_Megafires %>%
  monitor_filter(stringr::str_detect(AQSID, '^41039')) %>%
  monitor_filterDate(20150822, 20150823)

LaneCounty %>%
  aqiCategories()

LaneCounty %>%
  aqiCategories(conversionArray = US_AQI$names_eng)

Run the code above in your browser using DataLab