Re: [R] akima interpolation and triangulation question

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu, 29 May 2008 09:34:13 +0100 (BST)

You have repeated (u,v) values in your data frame. It is not possible to interpolate such data, and I get an error from 'interp' (not NAs).

There is no problem with interpolating from a regular grid, but be aware that the triangulation-based methods are not isotropic in such a case (as the triangulation is not unique).

R-sig-geo would be a more appropriate list for such questions.

On Thu, 29 May 2008, steven wilson wrote:

> Dear all;
>
> First of all, this is probably a more conceptual question than a
> R-related one, but still want to give it a try. When working with the
> interpolation function "interp" from the package akima and the
> triangulation function "tri.mesh" from package tripack I've got NA's
> for the interpolation and "error" for the triangulation. The data is
> arranged in a regular grid as opposed to what the help page for interp
> says but I think this is an interesting problem because I found this
> code on the web as part of an stats course (and it is not the only
> example I found). Because I'm not really into the details of the
> functions I would like to hear comments from people who have used
> these functions before.
>
> This is the code
>
> 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
> plot.surface(soil.interp)
>
> # spline interpolation
> soil.interp2 <- interp(u, v, moist, linear = F) # spline interpolation
> returns only NA's
>
> # triangulation
> tri.mesh(soil$u, soil$v) # got error
>
> Thanks
>
> ______________________________________________
> R-help_at_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.
>

-- 
Brian D. Ripley,                  ripley_at_stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help_at_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.
Received on Thu 29 May 2008 - 10:27:28 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 29 May 2008 - 18:30:42 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive