aggregate_m: Aggregate by Month

View source: R/time-aggregate.R

aggregate_mR Documentation

Aggregate by Month

Description

Aggregate by Month

Usage

aggregate_m(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.

Symbol Aggregate
y year
m month
d day
j julien day
s season
wy water year

See Also

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

Examples

## Not run: 
# 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)})

## End(Not run)

mikejohnson51/nwmTools documentation built on Dec. 4, 2024, 12:25 p.m.