EEAaq_get_data {EEAaq} | R Documentation |
Download air quality data at european level from the EEA download service
Description
This function imports air quality datasets at european level, based on the zone, time and pollutant specifications.
This function generates an EEAaq_df
object, or an EEAaq_df_sfc
.
Usage
EEAaq_get_data(
zone_name = NULL,
NUTS_level = NULL,
pollutant = NULL,
from = NULL,
to = NULL,
ID = FALSE,
quadrant = NULL,
polygon = NULL,
verbose = TRUE
)
Arguments
zone_name |
character vector specifying the names of the zones to consider. The reference is the NUTS and LAU nomenclature by Eurostat. See Details. |
NUTS_level |
character that specify the level of NUTS or LAU, to which |
pollutant |
the pollutants for which to download data. It may be:
|
from |
the starting point of the time window to consider. It may be:
|
to |
the ending point of the time window to consider. It may be:
|
ID |
logic value (T or F). If |
quadrant |
a list of bidimensional numeric vectors containing the coordinates in WGS84 format. If the list has two elements, the function builds a square using the two coordinates as opposite extremes. If the list contains three or more elements, every point is a vertex of a polygon, in particular the convex hull of the specified points. |
polygon |
A |
verbose |
logic value (T or F). If |
Details
The NUTS classification (Nomenclature of territorial units for statistics) is a hierarchical system for dividing up the economic territory of the EU and the UK. The levels are defined as follows:
NUTS 0: the whole country
NUTS 1: major socio-economic regions
NUTS 2: basic regions for the application of regional policies
NUTS 3: small regions for specific diagnoses
Further information is available at https://ec.europa.eu/eurostat/web/nuts/background.
These LAUs (Local Administrative Units) are the building blocks of the NUTS, and comprise the municipalities and communes of the European Union.
For further information see https://ec.europa.eu/eurostat/web/nuts/local-administrative-units.
Note that a specific name can be associated with both LAU and NUTS levels.
For instance "Milano" is either a city or a NUTS 3 area in Italy. To download data referred to the city,
specify zone_name = "Milano"
and NUTS_level = "LAU"
, while to download data referred to the province, specify
zone_name = "Milano"
and NUTS_level = "NUTS3"
.
One of zone_name
, quadrant
and polygon
should always be specified by the user.
Value
A data frame of class EEAaq_df
, if zone_name
is specified, and of class EEAaq_df_sfc
if whether the parameter quadrant
or polygon
is specified.
Examples
library(dplyr)
library(utils)
#Download of the PM10 data in Milan (Lombardia, Italy) during 2023.
EEAaq_get_data(zone_name = "Milano", NUTS_level = "LAU",
pollutant = "PM10", from = 2023, to = 2023, ID = FALSE, verbose = TRUE)
#Alternatively, it is possible to obtain the same result using
#the LAU_ID of Milan and the pollutant code:
EEAaq_get_data(zone_name = "015146", NUTS_level = "LAU",
pollutant = "PM10", from = 2023, to = 2023, ID = TRUE, verbose = TRUE)
#Another way to get the nitrogen dioxide in Milan during 2023,
#is to extract the geometry from the LAU dataset and use it with the polygon parameter:
temp <- tempfile()
download.file("https://github.com/AgostinoTassanMazzocco/EEAaq/raw/main/LAU.rds",
temp, quiet = TRUE)
milan <- readRDS(temp) %>%
filter(LAU_NAME == "Milano") %>%
pull(geometry)
EEAaq_get_data(pollutant = "PM10", from = 2023, to = 2023, polygon = milan)
#Another option is to choose the exact dates, for example,
#in order to import Milan PM10 january 2023 data,
#it is possible to write:
EEAaq_get_data(polygon = milan, pollutant = "PM10", from = "2023-01-01", to = "2023-01-31")
#Spcifying the parameter quadrant, it is possible to choose
#a specific quadrant on the geographic map.
#For instance, using the points (11.5, 46.5), (10.5, 46),
#will be imported data about the air quality stations
#located inside the rectangle which has, as opposite vertexes,
#the two selected points. In this case
#PM10 and PM2.5 data are downloaded for the whole 2021:
EEAaq_get_data(pollutant = c("PM10", "PM2.5"),
quadrant = list(c(11.5, 46.5), c(10.5, 46)),
from = 2021, to = 2021, verbose = TRUE)