catch_stats: Calculate full catchment statistics by summing field(s)...

Description Usage Arguments Value Note Examples

View source: R/catch_stats.R

Description

Calculate full catchment statistics by summing field(s) value(s) for all upstream catchments

Usage

1
catch_stats(sitelist, hierarchy, subcatchment.data, FUN, ...)

Arguments

sitelist

a vector of sites for which compiled statistics are to be calculated.

hierarchy

a dataframe containing catchment id and next downstream (nextds) id fields.

subcatchment.data

a vector or dataframe containing variables for which statistics are sought.

FUN

an unquoted scalar function used to summarise each field (e.g. min, mean, max).

...

further arguments passed to or from other methods.

Value

a vector or dataframe of aggregate values

Note

function to calculate full catchment statistics by summing each field of the table (or vector) subcatchment.data (length = no. of rows in hierarchy) For each site in sitelist, statistics as per scalar function FUN for all upstream catchments are deriveded using hierarchy in the function allupstream.

Examples

1
2
3
4
data(mwcats)

catch_stats(sitelist=mwcats$site[1:5], hierarchy = mwcats[,c(1:2)],
subcatchment.data=mwcats$scstrlen, FUN=sum)

nickbond/catchstats documentation built on Nov. 22, 2019, 3:41 a.m.