Aggregate by Month
aggregate_m(rawData, fun = "mean", na.rm = TRUE)
data extracted with readNWMdata
function to be applied to the flows column default = 'mean'
a logical value indicating whether NA values should be stripped before the computation proceeds.
NWM data is extracted as hourly values.
To aggregate hourly data to different time chunks the nwmHistoric package offers a family of aggregate functions.
Each of these begins with the prefix 'aggregate_' and is followed by the date symbol to aggregate to.
Symbol | Aggregate |
y | year |
m | month |
d | day |
j | julien day |
s | season |
wy | water year |
Other aggregate functions:
aggregate_dowy()
,
aggregate_j()
,
aggregate_record()
,
aggregate_s()
,
aggregate_wymd()
,
aggregate_wym()
,
aggregate_wys()
,
aggregate_wy()
,
aggregate_yj()
,
aggregate_ymd()
,
aggregate_ym()
,
aggregate_ys()
,
aggregate_y()
if (FALSE) {
# Get flow record for COMID 101
flows = readNWMdata(comid = 101)
# Aggregate to yearly average (y)
yearly = aggregate_y(flows, fun = 'mean')
# Aggregate to monthly
# minimum and maximum per year (ym)
ym = aggregate_ym(flows, fun = list(min, max))
# Aggregate to seasonal 95th percetile
# with using custom function
s95 = aggregate_s(flows, fun = function(x){quantile(x,.95)})
}