Level2Volume {EmiStatR} | R Documentation |
Function for linear interpolation given the relationship of two variables
Description
Given a relationship between two variables (e.g. level and volume), this function interpolates the corresponding second variable (e.g. volume) for a known value of the first variable (e.g. level). This function is suitable to represented e.g. the dynamics of water storage in a combined sewer overflow chamber.
Usage
Level2Volume(lev, lev2vol)
Arguments
lev |
A |
lev2vol |
A |
Details
The function uses the approx
function from the stats
package with
"yleft" argument equal to the minimum value of the second variable and "yright"
argument equal to the maximum value of the second variable.
Value
A numeric
object with one element representing the interpolated value
of the second variable (e.g. volume).
Author(s)
J.A. Torres-Matallana; K. Klepiszewski; G. Schutz.
Examples
library(EmiStatR)
# definition of relationship level to volume
lev2vol <- list(lev = c(.06, 1.10, 1.30, 3.30), vol = c(0, 31, 45, 200))
interpolated_volume <- Level2Volume(lev=c(0, .25, 1.25, 2.25, 4.25), lev2vol = lev2vol)
interpolated_volume