Learn R Programming

hydropeak (version 0.1.2)

change_points: Change Points

Description

Calculates flow (Q) differences of consecutive time steps and discriminates between time steps with increasing (IC: \(Q_{ts1} < Q_{ts2}\)) and decreasing (DC: \(Q_{ts1} > Q_{ts2}\)) flow. The differences are transformed to 1 or -1 if the number is positive or negative, respectively. Then the lengths of runs of equal values are computed to determine the change point indices in the input data frame. NA in Q values is replaced with 0 and treated as an equal trend.

Usage

change_points(x, rownames = FALSE, omit.constant = TRUE, omit.na = TRUE)

Value

A data frame which contains change point indices in the input data frame. These are the indices where an event starts and ends, and a column which indicates the event (-1 = decreasing (DC), 1 = increasing (IC)).

Arguments

x

Data frame (time series) of stage measurements. Data frame must contain a date-time column (Time) and a flow rate column (Q) and must be in a compatible format. (see flow()).

rownames

A logical. If FALSE (default) indices are used to determine change points, otherwise row names. rownames = TRUE is important for data with different IDs.

omit.constant

A logical. If FALSE (default) it does not return events with constant measurements. Otherwise these events are included.

omit.na

A logical. If FALSE (default) it does not return missing value events. Otherwise these events are included.