EAQI_PM: Calcualte particulate matter sub-index of the European Air...

Description Usage Arguments Details Value Colors References See Also Examples

View source: R/EAQI_PM.R

Description

The function returns the respective hourly EAQI grading, as defined by the European Environment Agency[1].

Usage

1
EAQI_PM(x, norm = "PM10", 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.

latex_cellcolors

Logical, if true the "EAQI_color_*" columns will show LaTeX \cellcolor code instead of HTML colors in a <span>. See Colors section.

Details

The index has six levels, named "good" (best air quality), "fair", "moderate", "poor", "very poor", and "extremely poor" (worst air quality). Thresholds are different between PM10 and PM2.5 particles.

Value

If raw=TRUE, a numeric vector with the raw EAQI values. Otherwise a data frame with four columns: raw input data, EAQI level (factor), recommended color code (factor). The column names start with "raw_", "EAQI_level_", and "EAQI_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{EAQIep}{HTML}{7D2181}
   - \definecolor{EAQIvp}{HTML}{960032}
   - \definecolor{EAQIp}{HTML}{FF5050}
   - \definecolor{EAQIm}{HTML}{F0E641}
   - \definecolor{EAQIf}{HTML}{50CCAA}
   - \definecolor{EAQIg}{HTML}{50F0E6}

References

[1] https://www.eea.europa.eu/themes/air/air-quality-index

See Also

AQI_US_PM, CAQI_PM

Examples

1
EAQI_PM(55)

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