| interp2xyz | R Documentation |
From an interp() result, produce a 3-column matrix
or data.frame cbind(x, y, z).
interp2xyz(al, data.frame = FALSE)
al |
a |
data.frame |
logical indicating if result should be data.frame or matrix (default). |
a matrix (or data.frame) with three columns, called
"x", "y", "z".
Martin Maechler, Jan.18, 2013
expand.grid() is the “essential ingredient” of
interp2xyz().
interp.
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)) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.