Coerce an object to an event hydrograph
as_hydrograph.Rd
Turn an object into an event hydrograph.
Usage
as_hydrograph(x, ...)
# S3 method for class 'data.frame'
as_hydrograph(x, ..., times_from, flows_from, unit = 1)
Arguments
- x
A data frame to coerce to a hydrograph.
- ...
Used for extensions to specific coercion methods.
- times_from
Column name containing timings of the hydrograph change points, including the terminus times. Unquoted.
- flows_from
Column name containing the discharge values corresponding to the timings in the
times_from
column; possibly unquoted.- unit
Conversion factor for the time values; single numeric. Useful if, for example, the timing is specified as a proportion of the total event time.
Value
An event hydrograph, as in hydrograph()
, made up of
linearly interpolated discharge-timing pairs.
Examples
df <- data.frame(when = 0:3, flows = c(2, 5, 4, 2))
h <- as_hydrograph(df, times_from = when, flows_from = flows)
plot(h)