Package 'AQIR'

Title: Air Quality Indexing and Statistical Reporting
Description: Provides a comprehensive framework for Air Quality Index (AQI) analysis from air pollutant concentration data using Central Pollution Control Board (CPCB) criteria. Calculates pollutant-specific AQI sub-indices and derives the overall AQI and its category, identifies the primary pollutant, and summarises, ranks, and visualizes results across monitoring locations. Methodology follows Central Pollution Control Board (2014,"National Air Quality Index") <https://app.cpcbccr.com/ccr_docs/FINAL-REPORT_AQI_.pdf>.
Authors: S. Hariharan [aut, cre], V. Ra. Charumathi [aut], S. Vishnu Shankar [aut]
Maintainer: S. Hariharan <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2026-10-08 10:55:32 UTC
Source: https://github.com/cran/AQIR

Help Index


Air Quality Indexing and Statistical Reporting

Description

Provides a comprehensive framework for Air Quality Index (AQI) analysis from air pollutant concentration data using Central Pollution Control Board (CPCB) criteria. Calculates pollutant-specific AQI sub-indices and derives the overall AQI and its category, identifies the primary pollutant, and summarises, ranks, and visualizes results across monitoring locations.

Usage

AQIR(data, verbose = TRUE)

Arguments

data

A data frame or tibble, or a file path (.csv, .xlsx, or .xls) pointing to one, containing the columns City and Datetime along with at least one of the pollutant columns PM25, PM10, NO2, SO2, CO, and NH3. Any of these pollutant columns not present in the data are skipped. Reading .xlsx/.xls files requires the readxl package.

verbose

Logical. If TRUE, summary statistics, plots, and progress messages are displayed.

Details

The function accepts a data frame/tibble or a CSV/Excel file path, validates and cleans the input (parsing dates, coercing pollutant values to numeric, and removing rows with missing, negative, or unparseable readings), computes pollutant-specific AQI sub-indices using standard CPCB breakpoint tables, determines the overall AQI as the maximum sub-index among the available pollutants, identifies the dominant (primary) pollutant, classifies air quality into standard AQI categories, summarizes AQI by month and location, ranks monitoring locations by average AQI, and produces graphical visualizations of the results.

Value

An invisible list containing:

  • data: The cleaned data with pollutant sub-indices, overall AQI, AQI category, and primary pollutant for each record.

  • city_summary: Average AQI, record count, and overall AQI category for each location.

  • ranking: Locations ranked by average AQI.

  • rows_dropped: Number of rows removed during data cleaning.

  • plots: A list of ggplot2 plots (trend, avg_by_location, category_dist, heatmap, monthly, boxplot, ranking), plus best_gauge and worst_gauge – plotly gauge charts for the best- and worst-performing locations, produced only when verbose = TRUE and the plotly package is installed.

References

Central Pollution Control Board (2014). "National Air Quality Index". https://app.cpcbccr.com/ccr_docs/FINAL-REPORT_AQI_.pdf

Examples

# A small example dataset
air_data <- data.frame(
  City = c("Chennai", "Coimbatore", "Madurai"),
  Datetime = c("2025-01-01", "2025-01-02", "2025-01-03"),
  PM25 = c(35, 28, 65),
  PM10 = c(70, 55, 120),
  NO2 = c(22, 18, 45),
  SO2 = c(10, 8, 20),
  CO = c(0.8, 0.6, 2.5),
  NH3 = c(120, 110, 180)
)

result <- AQIR(air_data, verbose = FALSE)