EEAaq_time_aggregate: Time aggregation of an 'EEAaq_df' class object.

View source: R/EEAaq_time_aggregate.R

EEAaq_time_aggregateR Documentation

Time aggregation of an EEAaq_df class object.

Description

EEAaq_time_aggregate compute a time aggregation of an EEAaq_df or EEAaq_df_sfc class object, based on the specified frequency and the aggregation functions aggr_fun.

Usage

EEAaq_time_aggregate(
  data = NULL,
  frequency = "monthly",
  aggr_fun = c("mean", "min", "max")
)

Arguments

data

an EEAaq_df or EEAaq_df_sfc class object, which is the output of the EEAaq_get_data function.

frequency

vector containing the time frequency for which to aggregate the data object. Admissible values are 'yearly', 'monthly', 'weekly', 'daily' 'hourly'.

aggr_fun

character vector containing one or more agregation functions. Admissible values are 'mean', 'median', 'min', 'max', 'sd', 'var', 'quantile_pp' (where pp is a number in the range [0,1], representing the required percentile).

Value

A EEAaq_taggr_df or a EEAaq_taggr_df_sfc class object, which is a tibble containing the required time aggregation.

Examples


`%>%` <- dplyr::`%>%`
### Filter all the stations installed in the city (LAU) of Milano (Italy)
IDstations <- EEAaq_get_stations(byStation = FALSE, complete = FALSE)
IDstations <- IDstations %>%
                dplyr::filter(LAU_NAME == "Milano") %>%
                dplyr::pull(AirQualityStationEoICode) %>%
                unique()
### Download NO2 measurement for the city of Milano from January 1st
###   to December 31st, 2023
data <- EEAaq_get_data(IDstations = IDstations, pollutants = "NO2",
                       from = "2023-01-01", to = "2023-01-31",
                       verbose = TRUE)

### Monthly aggregation: compute station-specific monthly minimum,
###   average, and maximum NO2 concentrations
t_aggr <- EEAaq_time_aggregate(data = data, frequency = "monthly",
                               aggr_fun = c("mean", "min", "max"))

### Weekly aggregation: compute station-specific monthly average and
###   standard deviation concentrations
t_aggr <- EEAaq_time_aggregate(data = data, frequency = "weekly",
                               aggr_fun = c("mean", "sd"))



EEAaq documentation built on April 3, 2025, 11:16 p.m.