coerce {terra} | R Documentation |
Coercion to other object types
## S4 method for signature 'SpatRaster'
as.vector(x, mode='any')
## S4 method for signature 'SpatRaster'
as.matrix(x, ...)
## S4 method for signature 'SpatRaster'
as.array(x)
x |
SpatRaster or SpatVector |
... |
additional argument |
mode |
this argument is ignored |
vector, matrix, or array
r <- rast(ncols=2, nrows=2)
values(r) <- 1:ncell(r)
as.vector(r)
as.matrix(r)
as.matrix(r, wide=TRUE)
as.data.frame(r, xy=TRUE)
as.array(r)