xyz2dataframe: Convert a surface in xyz to a data frame.

Description Usage Arguments Value Note Examples

View source: R/xyz2dataframe.prevR.r

Description

Several functions (for example GenKern::KernSur()) 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.

Usage

1
xyz2dataframe(xyz, xcol = 1, ycol = 2, zcol = 3)

Arguments

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 x[i], y[j].

xcol

x index.

ycol

y index.

zcol

z index.

Value

A data.frame.

Note

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).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
  x <- c(2,4,6,8,10)
  y <- x 
  op <- GenKern::KernSur(x,y, xgridsize=50, ygridsize=50,
                correlation=0, 
                xbandwidth=1, ybandwidth=1,
                range.x=c(0,13), range.y=c(0,13)
  )
  str(op)
  
  op.df <- xyz2dataframe(op)
  str(op.df)

prevR documentation built on Aug. 28, 2020, 5:08 p.m.