[R] bivariate linear interpolation

Halldór Björnsson halldor.bjornsson at gmail.com
Wed May 4 14:52:03 CEST 2011


Hi,

I have three matrices (X,Y,P) with the same dimension. The X,Y grid is
regular and I want to
perform linear interpolation to pick out certain points. In matlab
appropriate call is
something like

Pout=interp2(X,Y,P,Xout,Yout, method="linear")

where Xout and Yout are the locations where I want the Pout data
(typically a different grid).
(Scipy has this routine in interpolate.interp2d, with similar arguments)


In R there is (as often) the choice between many different
interpolation routines. Akima has one for irregularly spaced
data (and does not like co-linearity in the data). Fields has another
one, with a more complicated arguments.

What is the best R function that accomplishes this?

Sincerely
Halldór



More information about the R-help mailing list