Aggregate by Year-Month

aggregate_ym(rawData, fun = "mean", na.rm = TRUE)

Arguments

rawData

data extracted with readNWMdata

fun

function to be applied to the flows column default = 'mean'

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

Details

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.

SymbolAggregate
yyear
mmonth
dday
jjulien day
sseason
wywater year

Examples

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)})
}