grid.to.xyz: Convert Grid Matrix to (x,y,z) data.frame

grid.to.xyzR Documentation

Convert Grid Matrix to (x,y,z) data.frame

Description

Convert a grid matrix to a (x,y,z) data.frame.

Usage

grid.to.xyz(data, header, varname = "z", colnames = c("x", "y", varname))

Arguments

data

grid data: either a grid data matrix, or a list with components data (a matrix with the grid data) and header (the grid header information); see read.ascii.grid() for details

header

optional list giving grid header information; see read.ascii.grid() for details

varname

character: name to be assigned to the column with the z values in the output data.frame

colnames

names to be given to the columns corresponding to the x and y coordinates and the grid variable in the output data.frame

Value

a data.frame with three columns (names are specified in the colnames argument) giving the x and y coordinates and the attribute values at the locations given by the grid data.

See Also

read.ascii.grid(), pick.from.ascii.grid()

Examples

## Not run: 
d = read.ascii.grid("dem")
xyz = grid.to.xyz(d,varname="elevation")
str(xyz)

## End(Not run)

RSAGA documentation built on Dec. 10, 2022, 1:12 a.m.