AQI_US_PM: Calcualte particulate matter sub-index of the US Air Quality...

Description Usage Arguments Details Value Colors Note References See Also Examples

View source: R/AQI_US_PM.R

Description

The function returns the 24-hour AQI grading for given PM raw values, as defined by the United States Environmental Protection Agency (EPA)[1].

Usage

1
AQI_US_PM(x, norm = "PM10", raw = FALSE, latex_cellcolors = TRUE)

Arguments

x

A numeric vector of particulate matter measurements (µg/m³).

norm

One value of either "PM10" or "PM2.5", setting the PM size of the given values of x.

raw

Logical, if true returns only the AQI_US raw values.

latex_cellcolors

Logical, if true the "AQI_US_color_*" columns will show LaTeX \cellcolor code instead of HTML colors. See Colors section.

Details

The index has six levels, named "good" (best air quality), "moderate", "unhealthy for sensitive groups", "unhealthy", "very unhealthy", and "hazardous" (worst air quality). Thresholds are different between PM10 and PM2.5 particles.

Value

If raw=TRUE, a numeric vector with the raw AQI_US values. Otherwise a data frame with four columns: raw input data, AQI_US value, AQI_US level (factor), recommended color code (factor). The column names start with "raw_", "AQI_US_", "AQI_US_level_", and "AQI_US_color_", and end with either "PM10" or "PM2_5", depending on the value of norm.

Colors

The data frame contains rows to support coloring tables or plots, e.g. if you use the data in an RMarkdown document. If latex_cellcolors=FALSE, they provide a <span> with hexadecimal HTML color codes for each index value. Otherwise, the factor labels are in LaTeX format using the \cellcolor command. This is useful, e.g., if combined with the kableExtra::kable function. To use the code out of the box, define the following colors in your preamble (example shows usage in a YAML header):

1
2
3
4
5
6
7
header-includes:
   - \definecolor{AQIUSg}{HTML}{00e400}
   - \definecolor{AQIUSm}{HTML}{ffff00}
   - \definecolor{AQIUSus}{HTML}{ff7e00}
   - \definecolor{AQIUSu}{HTML}{ff0000}
   - \definecolor{AQIUSvu}{HTML}{99004c}
   - \definecolor{AQIUSh}{HTML}{7e0023}

Note

If there is no full 24-hours of data available, the AQI standard calculates a NowCast value from the last 12 hours. This is currently not implemented here, but available as a separate function.

References

[1] https://airnow.gov/index.cfm?action=aqibasics.aqi

See Also

NowCast_PM, EAQI_PM, CAQI_PM

Examples

1

unDocUMeantIt/paRticulates documentation built on Jan. 20, 2020, 5:15 p.m.