View source: R/xyz2dataframe.prevR.r
xyz2dataframe | R Documentation |
Several functions (for example KernSmooth::bkde2D()
)
return a surface as a list "xyz" composed of three elements:
vector of ordinates in the x dimension,
vector of ordinates in the y dimension and
a matrix with the values of the surface in x and y.
This function transforms a list "xyz" into a data frame.
xyz2dataframe(xyz, xcol = 1, ycol = 2, zcol = 3)
xyz |
a list with 3 elements: a vector with x-coordinates,
a vector with y-coordinates and
and matrix with value for each point of coordinates |
xcol |
x index. |
ycol |
y index. |
zcol |
z index. |
A data.frame
.
xyz
could be a list like x,y,z1,z2,z3
.
If so, zcol
should be equal
to c("z1","z2","z3")
or c(3,4,5)
.
x <- matrix(c(2, 4, 6, 8, 10, 2, 4, 6, 8, 10), ncol = 2)
op <- KernSmooth::bkde2D(x, bandwidth = 1)
str(op)
op.df <- xyz2dataframe(op)
str(op.df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.