Hello,

I have to vectors high and low on a time scale as follows
time <- 1:5
low <- c(1, 2, 3, 4, 5)
high <- c(5, 4, 3, 4, 4)

Now I'm searching for an elegant solution to know if a data point in time is
inside the boundaries but not only on the predefined time points but
continuous (e.g. time=2.5). For this the boundary points should be
interpolated linearly.

InBoundaries(t=2, y=1)  => FALSE (too low)
InBoundaries(t=2, y=2) => TRUE (on lower boundary)
InBoundaries(t=2.5, y=3) => TRUE (between interpolation lines)
InBoundaries(t=2.5, y=3.5) => TRUE (on upper interpolation line
InBoundaries(t=2.5, y=3.51) => FALSE (above upper interpolation line)

Thanks in advance for your ideas.

Kind regards
Martin

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to