Learn R Programming

terra (version 1.8-80)

as.data.frame: SpatRaster or SpatVector to data.frame

Description

Coerce a SpatRaster or SpatVector to a data.frame

Usage

# S4 method for SpatVector
as.data.frame(x, row.names=NULL, optional=FALSE, geom=NULL, ...)

# S4 method for SpatRaster as.data.frame(x, row.names=NULL, optional=FALSE, xy=FALSE, cells=FALSE, time=FALSE, na.rm=NA, wide=TRUE, ...)

Arguments

Value

data.frame

See Also

as.list, as.matrix. See geom to only extract the geometry of a SpatVector

Examples

Run this code
f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
as.data.frame(v)

Run the code above in your browser using DataLab