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.

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

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.

Value

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

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.

Note

On February 7, 2024, EPA strengthened the National Ambient Air Quality Standards for Particulate Matter (PM NAAQS) to protect millions of Americans from harmful and costly health impacts, such as heart attacks and premature death. Particle or soot pollution is one of the most dangerous forms of air pollution, and an extensive body of science links it to a range of serious and sometimes deadly illnesses. EPA is setting the level of the primary (health-based) annual PM2.5 standard at 9.0 micrograms per cubic meter to provide increased public health protection, consistent with the available health science. See PM NAAQS update.

See also

Examples

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()
#>       [,1] [,2] [,3] [,4] [,5] [,6]
#>  [1,]    1    1    1    1    1    1
#>  [2,]    1    1    1    1    1    1
#>  [3,]    1    1    1    1    1    1
#>  [4,]    1    1    1    1    1    1
#>  [5,]    1    1    1    1    1    1
#>  [6,]    1    1    1    1    1    1
#>  [7,]    1    1    1    1    1    1
#>  [8,]    1    1    1    1    1    1
#>  [9,]    1    1    1    1    1    1
#> [10,]    1    1    1    1    1    1
#> [11,]    1    1    1    1    1    1
#> [12,]    1    1    1    1    1    1
#> [13,]    2    1    2    1    1    1
#> [14,]    2    2    2    2    1    1
#> [15,]    2    2    3    2    1    1
#> [16,]    4    3    4    2    1    2
#> [17,]    4    4    5    4    1    2
#> [18,]    5    5    5    5    1    3
#> [19,]    5    5    6    5    2    4
#> [20,]    6    5    6    5    3    5
#> [21,]    6    5    6    5    2    5
#> [22,]    6    5    6    5    2    5
#> [23,]    6    5    6    5    2    5
#> [24,]    6    5    6    5    3    5

LaneCounty %>%
  aqiCategories(conversionArray = US_AQI$names_eng)
#>       [,1]             [,2]             [,3]             [,4]            
#>  [1,] "Good"           "Good"           "Good"           "Good"          
#>  [2,] "Good"           "Good"           "Good"           "Good"          
#>  [3,] "Good"           "Good"           "Good"           "Good"          
#>  [4,] "Good"           "Good"           "Good"           "Good"          
#>  [5,] "Good"           "Good"           "Good"           "Good"          
#>  [6,] "Good"           "Good"           "Good"           "Good"          
#>  [7,] "Good"           "Good"           "Good"           "Good"          
#>  [8,] "Good"           "Good"           "Good"           "Good"          
#>  [9,] "Good"           "Good"           "Good"           "Good"          
#> [10,] "Good"           "Good"           "Good"           "Good"          
#> [11,] "Good"           "Good"           "Good"           "Good"          
#> [12,] "Good"           "Good"           "Good"           "Good"          
#> [13,] "Moderate"       "Good"           "Moderate"       "Good"          
#> [14,] "Moderate"       "Moderate"       "Moderate"       "Moderate"      
#> [15,] "Moderate"       "Moderate"       "USG"            "Moderate"      
#> [16,] "Unhealthy"      "USG"            "Unhealthy"      "Moderate"      
#> [17,] "Unhealthy"      "Unhealthy"      "Very Unhealthy" "Unhealthy"     
#> [18,] "Very Unhealthy" "Very Unhealthy" "Very Unhealthy" "Very Unhealthy"
#> [19,] "Very Unhealthy" "Very Unhealthy" "Hazardous"      "Very Unhealthy"
#> [20,] "Hazardous"      "Very Unhealthy" "Hazardous"      "Very Unhealthy"
#> [21,] "Hazardous"      "Very Unhealthy" "Hazardous"      "Very Unhealthy"
#> [22,] "Hazardous"      "Very Unhealthy" "Hazardous"      "Very Unhealthy"
#> [23,] "Hazardous"      "Very Unhealthy" "Hazardous"      "Very Unhealthy"
#> [24,] "Hazardous"      "Very Unhealthy" "Hazardous"      "Very Unhealthy"
#>       [,5]       [,6]            
#>  [1,] "Good"     "Good"          
#>  [2,] "Good"     "Good"          
#>  [3,] "Good"     "Good"          
#>  [4,] "Good"     "Good"          
#>  [5,] "Good"     "Good"          
#>  [6,] "Good"     "Good"          
#>  [7,] "Good"     "Good"          
#>  [8,] "Good"     "Good"          
#>  [9,] "Good"     "Good"          
#> [10,] "Good"     "Good"          
#> [11,] "Good"     "Good"          
#> [12,] "Good"     "Good"          
#> [13,] "Good"     "Good"          
#> [14,] "Good"     "Good"          
#> [15,] "Good"     "Good"          
#> [16,] "Good"     "Moderate"      
#> [17,] "Good"     "Moderate"      
#> [18,] "Good"     "USG"           
#> [19,] "Moderate" "Unhealthy"     
#> [20,] "USG"      "Very Unhealthy"
#> [21,] "Moderate" "Very Unhealthy"
#> [22,] "Moderate" "Very Unhealthy"
#> [23,] "Moderate" "Very Unhealthy"
#> [24,] "USG"      "Very Unhealthy"