[R-sig-Geo] akima interpolation + Delaunay triangulation

steven wilson swpt07 at gmail.com
Tue Jun 3 17:54:37 CEST 2008


Dear all;

I would like to have some input from anybody who have used the
interpolation function (interp) in the akima package and the
triangulation function (tri.mesh) from the tripack pakage. My problem
is that for a given data set these functions return errors in R while
in S-Plus they don't. The versions of these functions in S-Plus
(S+SpatialStats) can be slightly different to those in R but the
output shoould be the same or approx the same because they're based on
the same algorithm and fortran code.

Here is the code in R:

library(akima)
library(fields)
library(tripack)

soil <- read.table("http://www.unc.edu/~zhuz/teaching/Stat890/Data/soil.txt",header=TRUE)
attach(soil)
soil.interp <- interp(u, v, moist) # linear interpolation works and
the results are similar to those in S-Plus
plot.surface(soil.interp)

# spline interpolation
soil.interp2 <- interp(u, v, moist, linear = F) # spline interpolation
returns only NA's in R while using S-Plus it works fine

# triangulation
tri.mesh(soil$u, soil$v)  # error in R, works in S-Plus

Any comments will be appreciated

Thanks




More information about the R-sig-Geo mailing list