calculate_durations: Calculate durations

Description Usage Arguments Value

View source: R/calculate_durations.R

Description

Given a data frame with a "lake", "date", and "level" columns as well as a vector of desired exceedance probabilities, calculates consecutive months at/above (for probabilities <= 50%) or at/below (for probabilities >= 50%) the exceedance levels.

Usage

1
2
3
4
5
6
calculate_durations(
  df,
  probs = c(10, 25, 50, 75, 90),
  departures = FALSE,
  exceeds = NULL
)

Arguments

df

a data frame with a "lake" and a "level" column

probs

a vector with all exceedance probabilities to calculate. Defaults to c(10, 25, 75, 90).

departures

logical defaults to FALSE. If TRUE, calculates durations 1ft above median and 1ft below median

exceeds

defaults to NULL. If provided, should be a data frame with first column "lake" and subsequent columns corresponding to exceedance probabilities (e.g., "10", "25", "50", "75", "90") and associated lake levels.

Value

durations, a data frame with the following columns:

lake

name of lake

variable

exceedance probability, e.g., "10", "25", "75", "90", "a50" (for above 50%), "b50" (for below 50%)

value

one count of number of months levels were consecutively above or below the given exceedance probability


WDNR-Water-Use/CSLSscenarios documentation built on Nov. 10, 2021, 4:14 p.m.