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

View source: R/catch_stats.R

catch_statsR Documentation

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

Description

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

Usage

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

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 July 10, 2024, 9:56 a.m.