Description Usage Arguments Details Value
View source: R/recessions_analysis.R
This function fits exponential models to individual segments of the extracted recessions and compute the correseponding early and late recession times.
1 2 3 4 5 6 7 8 | recession_times(
Q,
i_events,
segments = list(1L:5L, 15L:30L),
n_min = 5L,
summary_fun = median,
...
)
|
Q |
numeric vector. Streamflow vector. |
i_events |
numeric data.frame. A two-column data frame containing the index of the start and end of each recession events. See the function recession_events_index(). |
segments |
list. A list defining the segments of recession events. See details. |
n_min |
integer. The minimum number of valid (non-missing) streamflow values to compute a valid recssion time. If, for a given segment, the number of valid streamflow value is below 'n_min', the corresponding recession time will be set to NA. |
summary_fun |
function. The summary function to use aggregate the values accross all recession events. Given a numeric vector as first argument, this function must return a single value. It default to the 'median' function. If set to NULL, a data.frame containing all the recession times for all recssion events and all segments is returned. |
... |
Additional argument to pass to the summary function 'summary_fun'. |
By default the function considers two segments, the 5 first days and the segment from day 15 to day 30 from the start of each recession event. This is defined in the 'segments' argument as a list containing the indices (relative to the start of each recession event) of each segments. The argument 'segment' can be used to define 1, 2 or more segments.
Returns a vector with as many elements as the defined segments containing the aggregated recession times. If 'summary_fun' is not a function, a data.frame with as many column as the defined segments and as many rows as the number of recession events is returned.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.