View source: R/time-aggregate.R
| aggregate_ym | R Documentation |
Aggregate by Year-Month
aggregate_ym(rawData, fun = "mean", na.rm = TRUE)
rawData |
data extracted with |
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. |
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_m(),
aggregate_record(),
aggregate_s(),
aggregate_wymd(),
aggregate_wym(),
aggregate_wys(),
aggregate_wy(),
aggregate_yj(),
aggregate_ymd(),
aggregate_ys(),
aggregate_y()
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.