interpp {akima}  R Documentation 
Pointwise Bivariate Interpolation for Irregular Data
Description
These functions implement bivariate interpolation onto a set of points
for irregularly spaced input data. These functions are only for
backward compatibility, use interpp
instead.
If linear
is \codeTRUE, linear
interpolation is used in the triangles bounded by data points, otherwise
cubic interpolation is done.
If extrap
is FALSE
, zvalues for points outside the
convex hull are returned as NA
. No extrapolation can be
performed for linear interpolation.
The interpp
function handles duplicate (x,y)
points in
different ways. As default it will stop with an error message. But it
can give duplicate points an unique z
value according to the
parameter duplicate
(mean
,median
or any other
user defined function).
The triangulation scheme used by interp
works well if x
and y
have similar scales but will appear stretched if they
have very different scales. The spreads of x
and y
must
be within four orders of magnitude of each other for interpp
to
work.
Usage
interpp(x, y=NULL, z, xo, yo=NULL, linear=TRUE, extrap=FALSE,
duplicate = "error", dupfun = NULL,
jitter = 10^12, jitter.iter = 6, jitter.random = FALSE,
remove = !linear)
Arguments
x 
vector of xcoordinates of data points or a

y 
vector of ycoordinates of data points. Missing values are not accepted. If left as NULL indicates that 
z 
vector of zcoordinates of data points or a character variable
naming the variable of interest in the
Missing values are not accepted.

xo 
vector of xcoordinates of points at which to evaluate the interpolating
function. If 
yo 
vector of ycoordinates of points at which to evaluate the interpolating function. If operating on 
linear 
logical – indicating wether linear or spline interpolation should be used. 
extrap 
logical flag: should extrapolation be used outside of the convex hull determined by the data points? Not possible for linear interpolation. 
duplicate 
indicates how to handle duplicate data points. Possible values are

dupfun 
this function is applied to duplicate points if 
jitter 
Jitter of amount of Note that the jitter is not generated randomly unless

jitter.iter 
number of iterations to retry with jitter, amount
will be increased in each iteration by 
jitter.random 
logical, see 
remove 
logical, indicates whether Akimas removal of thin triangles along
the border of the convex hull should be performed, experimental setting!
defaults to 
Value
list with 3 components:
x 
vector of xcoordinates of output points, the same as the input
argument 
y 
vector of ycoordinates of output points, the same as the input
argument 
z 
fitted zvalues. The value 
If input is SpatialPointsDataFrame
than an according
SpatialPointsDataFrame
is returned.
NOTE
Use interp
if interpolation on a regular grid is wanted.
See interp
for more details.
References
Akima, H. (1978). A Method of Bivariate Interpolation and Smooth Surface Fitting for Irregularly Distributed Data Points. ACM Transactions on Mathematical Software, 4, 148164.
Akima, H. (1996). Algorithm 761: scattereddata surface fitting that has the accuracy of a cubic polynomial. ACM Transactions on Mathematical Software, 22, 362371.
R. J. Renka (1996). Algorithm 751: TRIPACK: a constrained twodimensional Delaunay triangulation package. ACM Transactions on Mathematical Software. 22, 18.
R. J. Renka and Ron Brown (1998). Remark on algorithm 761. ACM Transactions on Mathematical Software. 24, 383385.
See Also
contour
, image
,
approxfun
, splinefun
,
outer
, expand.grid
,
interp
, aspline
.
Examples
data(akima)
# linear interpolation at points (1,2), (5,6) and (10,12)
akima.lip<interpp(akima$x, akima$y, akima$z,c(1,5,10),c(2,6,12))
akima.lip$z
# spline interpolation at the same locations
akima.sip<interpp(akima$x, akima$y, akima$z,c(1,5,10),c(2,6,12),
linear=FALSE)
akima.sip$z
## Not run:
## interaction with sp objects:
library(sp)
## take 30 sample points out of meuse grid:
data(meuse.grid)
m0 < meuse.grid[sample(1:3103,30),]
coordinates(m0) < ~x+y
## interpolate on this 30 points:
## note: both "meuse" and "m0" are sp objects
## (SpatialPointsDataFrame) !!
## arguments z and xo have to given, y has to be omitted!
ipp < interpp(meuse,z="zinc",xo=m0)
spplot(ipp)
## End(Not run)