View source: R/EEAaq_time_aggregate.R
EEAaq_time_aggregate | R Documentation |
EEAaq_df
class object.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
.
EEAaq_time_aggregate(
data = NULL,
frequency = "monthly",
aggr_fun = c("mean", "min", "max")
)
data |
an |
frequency |
vector containing the time frequency for which to aggregate the |
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). |
A EEAaq_taggr_df
or a EEAaq_taggr_df_sfc
class object, which is a tibble containing the
required time aggregation.
`%>%` <- 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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.