Learn R Programming

AirMonitor (version 0.4.2)

monitor_toAQCTable: Convert monitor data into an AQI category table

Description

Creates a table of AQI category vs monitoring site with a count of the number of times each AQI category was experienced at each site. The count will be a count of hours or days depending on averaging period of the incoming monitor object.

When siteIdentifier is used, the identifiers must be in the same order as monitor$meta.

Usage

monitor_toAQCTable(
  monitor,
  NAAQS = c("PM2.5_2024", "PM2.5"),
  siteIdentifier = "locationName"
)

Value

Table of AQI category counts.

Arguments

monitor

mts_monitor object.

NAAQS

Version of NAAQS levels to use. See Note.

siteIdentifier

Metadata column used to identify sites or a character vector with site identifiers.

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(20150801, 20150901)

# Count of hours each site spent in each AQ category in August
LaneCounty %>%
  monitor_toAQCTable()

# Count of days each site spent in each AQ
LaneCounty %>%
  monitor_dailyStatistic(mean) %>%
  monitor_toAQCTable()

# Count of days each site spent in each AQ (simplified names)
siteNames <- c(
  "Eugene 1", "Eugene 2", "Eugene 3",
  "Springfield", "Oakridge", "Cottage Grove"
)
LaneCounty %>%
  monitor_dailyStatistic(mean) %>%
  monitor_toAQCTable(siteIdentifier = siteNames)

# Count of days at each AQ level with the new, 2024 NAAQS
LaneCounty %>%
  monitor_dailyStatistic(mean) %>%
  monitor_toAQCTable(NAAQS = "PM2.5_2024")


Run the code above in your browser using DataLab