| as.polygons | R Documentation | 
Conversion of a SpatRaster, SpatVector or SpatExtent to a SpatVector of polygons.
## S4 method for signature 'SpatRaster'
as.polygons(x, round=TRUE, aggregate=TRUE, values=TRUE,
		na.rm=TRUE, na.all=FALSE, extent=FALSE, digits=0, ...)
## S4 method for signature 'SpatVector'
as.polygons(x, extent=FALSE)
## S4 method for signature 'SpatExtent'
as.polygons(x, crs="")
x | 
 SpatRaster, SpatVector or SpatExtent  | 
round | 
 logical; If   | 
aggregate | 
 logical; combine cells with the same values? If   | 
values | 
 logical; include cell values as attributes?  | 
extent | 
 logical. if   | 
na.rm | 
 logical. If   | 
na.all | 
 logical. If   | 
digits | 
 integer. The number of digits for rounding (if   | 
crs | 
 character. The coordinate reference system (see   | 
... | 
 additional arguments. For backward compatibility. Will be removed in the future  | 
SpatVector
as.lines, as.points
r <- rast(ncols=2, nrows=2)
values(r) <- 1:ncell(r)
p <- as.polygons(r)
p
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.