R/group5.R

#'Calculate the group 5 IHA parameters.
#'
#'The group 5 IHA parameters measure the rate and frequency of water condition
#'changes.
#'

#'@param x A zoo object containing the flow series
#'@param year the type of year factor to be used, \code{yr = 'water'} or \code{yr = 'calendar'}
#'for water years and calendar years respectively
#'@return a matrix of group 5 parameters
#'@author [email protected]@gmail.com
#'@references \url{http://www.conservationgateway.org/Files/Pages/indicators-hydrologic-altaspx47.aspx}
#'@export
#'@examples
#'data(bullrun)
#'group5(bullrun, 'water')
`group5` <- function (x, year = c('water', 'calendar')){
  year <- match.arg(year)
  yr <- switch(year,
               water = water.year(index(x)),
               calendar = year(index(x)))
  sx <- split(as.numeric(x), yr)
  res <- sapply(sx, FUN = meandiff)
  dimnames(res)[[1]] <- c("Rise rate", "Fall rate", "Reversals")
  return(t(res))
}

Try the IHA package in your browser

Any scripts or data that you put into this service are public.

IHA documentation built on May 2, 2019, 5:15 p.m.