Calculate data set statistics for selected time intervals.
Usage
calcDateRangeStat(
data,
from = NULL,
to = NULL,
stat = NULL,
pollutant = NULL,
...,
method = 2
)
calcRollingDateRangeStat(
data,
range = "year",
res = "day",
stat = NULL,
pollutant = NULL,
from = NULL,
to = NULL,
...,
method = 2
)Arguments
- data
(data.frame, tibble, etc) Data set containing data statistic to be calculated for, and
datecolumn of date/time records.- from
(various) Start date(s) to subsample from when calculating statistic, by default end of supplied
datadate range.- to
(various) End date(s) to subsample to when calculating statistic, by default end of supplied
datadate range.- stat
(function) Statistic to be applied to selected data, by default
mean(pollutant, na.rm=TRUE). NB: This should be a function that works on vectors in the formfunction(x).- pollutant
(character) The name(s) of data-series to analyse in
data, by default all columns in supplied data exceptdate.- ...
extra arguments.
- method
(numeric) Method to use when calculating statistic. Currently 1 (using base R), 2 (using dplyr), 3 (using data.table), and 4 (using dplyr and purrr)
- range
(character) For
calcRollingDateRange, the range the rolling date windows, by default'year'for annual statistic calculations.- res
(character) For
calcRollingDateRange, the resolution to calculate the rolling statistic at, by default'day'to calculate this once per day.
