aqiColors: Generate AQI colors

View source: R/aqiColors.R

aqiColorsR Documentation

Generate AQI colors

Description

This function uses the leaflet::colorBin() function to return a vector or matrix of colors derived from data values.

Usage

aqiColors(
  x,
  pollutant = c("PM2.5", "AQI", "CO", "NO", "OZONE", "PM10", "SO2"),
  palette = c("EPA", "subdued", "deuteranopia"),
  na.color = NA,
  NAAQS = c("PM2.5_2024", "PM2.5")
)

Arguments

x

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

pollutant

EPA AQS criteria pollutant.

palette

Named color palette to use for AQI categories.

na.color

Color assigned to missing values.

NAAQS

Version of NAAQS levels to use. See Note.

Value

A vector or matrix of AQI colors to be used in maps and plots.

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

aqiCategories

Examples

library(AirMonitor)

# Fancy plot based on pm2.5 values
pm2.5 <- Carmel_Valley$data[,2]
Carmel_Valley %>%
  monitor_timeseriesPlot(
    shadedNight = TRUE,
    pch = 16,
    cex = pmax(pm2.5 / 100, 0.5),
    col = aqiColors(pm2.5),
    opacity = 0.8
  )

AirMonitor documentation built on Sept. 27, 2024, 9:06 a.m.