Hans W Borchers wrote : > First define a function from those points: > > fx <- approxfun(x, f_x) > fy <- approxfun(y, f_y) > f <- function(x) abs(fx(x)-fy(x)) > > and now you can apply integrate() or trapz(): > > xx <- sort(c(x, y)) > yy <- f(xx) > trapz(xx, yy) > > trapz() should return the more accurate (i.e. exact) result.
Thanks a lot Hans! I didn't know about the 'approx' functions and that was exaclty what I needed! Regards, Xavier ______________________________________________ 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.