Bicubic/bilinear interpolation in R I have a data set of x,y,z data and I'd like to do a bicubic interpolation. x and y are spatial coordinates and z is a temperature.
Below there are two images. The first one is a (gnuplot) plot of my dataset and the second one is an interpolated version (set pm3d interpolate 10,10).
Now I'd like to do this interpolation in R but I want a matrix of values as result and not a plot. The climates package seemed to provide this in R, but it does not work in R 2.13 anymore. 
Is there another way/package to interpolate in R the way I want?


 A: Check out the akima package's interp.

These functions implement bivariate interpolation onto a grid for irregularly spaced input data. Bilinear or bicubic spline interpolation is applied using different versions of algorithms from Akima.
Usage
interp(x, y, z, xo=seq(min(x), max(x), length = 40),
         yo=seq(min(y), max(y), length = 40),
         linear = TRUE, extrap=FALSE, duplicate = "error", dupfun =
  NULL, ncp = NULL)

I assume it will work if your data is regularly spaced as well.
A: You could use image.smooth in the fields package.
A: To export the data you have interpolated , you could use the follow way:
model <- interp(x, y, z, xo=seq(min(x), max(x), length = 40), yo=seq(min(y),
    max(y), length = 40), linear = TRUE, extrap=FALSE, duplicate = "error", 
    dupfun = NULL, ncp = NULL)
interpData <- model$z

Load the follow libraries
library(rJava)
library(xlsxjars)
library(xlsx)

Export your interpolated data in Excel with title multivariateInterp in your hard disc
write.xlsx (interpData, "c:/multivariateInterp.xlsx")

