I have approximated a function y = f(x) by sampling at different values of x. The curve produced by joining up the points crosses y=0 zero at two points, which are within the range of x values sampled and I would like to estimate (approximately) the x values at these points. I think this is best done using linear interpolation, but I am stuck as how to do this.
Here is a data.frame containing the y and x values. data.frame(x = c(0.00000, 0.00010, 0.00100, 0.01000, 0.02404, 0.07603, 0.10000, 0.12021, 0.15146, 0.19083, 0.24007, 0.24043, 0.24049, 0.30292, 0.38166, 0.48086, 0.76031, 1.00000, 2.00000, 2.40430), y=c(-10.173, -5.046, -2.691, -0.093, 0.791, 1.643, 1.782, 1.858, 1.933, 1.982, 2.000, 2.000, 2.000, 1.980, 1.913, 1.786, 1.318, 0.866, -0.846, -1.397)) Any help greatly appreciated. Dan Halligan (P.S. I posted a similar question earlier, I hope this is simpler and better phrased) ______________________________________________ R-help@stat.math.ethz.ch 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.