## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")

## ----diagram, echo = FALSE, out.width = "100%", fig.alt = "Call graph of the EEAaq package in five bands: sources, metadata, download and storage, description and aggregation, maps"----
knitr::include_graphics("function-map.svg")

## ----files, eval = FALSE------------------------------------------------------
# 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")

## ----session, eval = FALSE----------------------------------------------------
# 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")

## ----regenerate, eval = FALSE-------------------------------------------------
# # from the root of the repository
# source("dev/make-function-map.R")

