Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

interp2xyz

From interp() Result, Produce 3-column Matrix


Description

From an interp() result, produce a 3-column matrix or data.frame cbind(x, y, z).

Usage

interp2xyz(al, data.frame = FALSE)

Arguments

al

a list as produced from interp().

data.frame

logical indicating if result should be data.frame or matrix (default).

Value

a matrix (or data.frame) with three columns, called "x", "y", "z".

Author(s)

Martin Maechler, Jan.18, 2013

See Also

expand.grid() is the “essential ingredient” of interp2xyz().

Examples

data(akima)
ak.spl <- with(akima, interp(x, y, z, linear = FALSE,
                             xo= seq(0,25, length=100),
                             yo= seq(0,20, length= 96)))
str(ak.spl)# list (x[i], y[j], z = <matrix>[i,j])

## Now transform to simple  (x,y,z)  matrix / data.frame :
str(am <- interp2xyz(ak.spl))
str(ad <- interp2xyz(ak.spl, data.frame=TRUE))
## and they are the same:
stopifnot( am == ad | (is.na(am) & is.na(ad)) )

akima

Interpolation of Irregularly and Regularly Spaced Data

v0.6-2.1
ACM | file LICENSE
Authors
Hiroshi Akima [aut, cph] (Fortran code (TOMS 760, 761, 697 and 433)), Albrecht Gebhardt [aut, cre, cph] (R port (interp* functions), bicubic* functions), Thomas Petzold [ctb, cph] (aspline function), Martin Maechler [ctb, cph] (interp2xyz function + enhancements), YYYY Association for Computing Machinery, Inc. [cph] (covers code from TOMS 760, 761, 697 and 433)
Initial release
2016-12-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.