as.data.frame {terra} | R Documentation |
SpatRaster or SpatVector to data.frame
Description
Coerce a SpatRaster or SpatVector to a data.frame
Usage
## S4 method for signature 'SpatVector'
as.data.frame(x, row.names=NULL, optional=FALSE, geom=NULL, ...)
## S4 method for signature 'SpatRaster'
as.data.frame(x, row.names=NULL, optional=FALSE, xy=FALSE,
cells=FALSE, time=FALSE, na.rm=NA, wide=TRUE, ...)
Arguments
x |
SpatRaster or SpatVector |
geom |
character or NULL. If not NULL, either "WKT" or "HEX", to get the geometry included in Well-Known-Text or hexadecimal notation. If |
xy |
logical. If |
time |
logical. If |
na.rm |
logical. If |
cells |
logical. If |
wide |
logical. If |
... |
Additional arguments passed to the |
row.names |
This argument is ignored |
optional |
This argument is ignored |
Value
data.frame
See Also
as.list, as.matrix
. See geom
to only extract the geometry of a SpatVector
Examples
f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
as.data.frame(v)