> I have two vectors and connect the points by line segments:
> 
> x <- c(1990,1994,1995,1997)
> y <- c(30,40,80,20)
> plot(x,y,type="l")
> 
> I want to get the values of y's on these lines at missing x's,
> i.e., at 1991,1992,1993,and 1996. Is there a simple way to do this?
> 
Easy:
approx(x, y, c(1991:1993, 1996))$y
while
approx(x, y, 1990:1997)$y
will give you all the y values.

Hope this helps,
Ray Brownrigg <[EMAIL PROTECTED]>       http://www.mcs.vuw.ac.nz/~ray

______________________________________________
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to