Map of the package

This vignette is the map of EEAaq: what each function is for, and how the functions call one another. It is meant to be read once, before the manual pages and the extended vignette.

Call graph of the EEAaq package in five bands: sources, metadata, download and storage, description and aggregation, maps

The same diagram, a PDF version and the complete list of the calls are installed with the package:

system.file("extdata", "EEAaq_function_map.svg", package = "EEAaq")
system.file("extdata", "EEAaq_function_map.pdf", package = "EEAaq")
system.file("extdata", "EEAaq_function_map.md", package = "EEAaq")

The five bands

1. Sources, outside the package

EEAaq stores no data. The measurements come from the EEA Air Quality Download Service, which distributes them as parquet files in three datasets: the historical Airbase data (until 2012), the verified E1a data (2013-2024) and the up-to-date, unverified E2a data (from 2025). The metadata (stations, pollutants, NUTS regions and LAU municipalities) come from the EEA, the EIONET vocabulary and Eurostat GISCO; they change slowly and need cleaning before they can be joined to the measurements, so the maintainers prepare them and publish them in the folder Support_files/ of the GitHub repository.

2. Metadata

3. Download and storage

4. Description and aggregation

5. Maps

Both rely on code_extr() to read the level of the NUTS regions they draw.

A typical session

library(EEAaq)
`%>%` <- dplyr::`%>%`

# 1. choose the stations: here, those of the province of Milano
IDstations <- EEAaq_get_stations(byStation = TRUE, complete = FALSE) %>%
  dplyr::filter(NUTS3 %in% c("Milano")) %>%
  dplyr::pull(AirQualityStationEoICode) %>%
  unique()

# 2. download the measurements
data <- EEAaq_get_data(IDstations = IDstations, pollutants = c("PM10", "NO2"),
                       from = "2024-01-01", to = "2024-01-15")

# 3. describe and aggregate them
summ   <- EEAaq_summary(data = data)
t_aggr <- EEAaq_time_aggregate(data = data, frequency = "daily", aggr_fun = "mean")

# 4. map the stations and interpolate the daily means
EEAaq_map_stations(data = data, NUTS_extborder = "NUTS2", NUTS_intborder = "LAU")
EEAaq_idw_map(data = t_aggr, pollutant = "NO2", aggr_fun = "mean",
              NUTS_filler = "NUTS3", NUTS_extborder = "NUTS2")

Every step except the aggregation reads from the internet; the extended vignette runs the same session on data shipped with the package.

Regenerating the map

The diagram and the list of the calls are generated by dev/make-function-map.R in the GitHub repository of the package (https://github.com/PaoloMaranzano/EEAaq_R), which finds the calls by a static scan of the sources, so that the map cannot drift from the code:

# from the root of the repository
source("dev/make-function-map.R")