is_raster | R Documentation |
is_raster
is used to permit flexibility in the use of rasters, matrices or arrays in many functions.
is_raster(r)
r |
an R object |
if r
is a SpatRaster, returns a matrix containing all values of r
, otherwise returns r
library(terra)
r <- is_raster(dtm100m)
class(dtm100m) # is a PackedSpatRaster
class(r) # is a matrix
plot(r) # not a SpatRaster
plot(rast(r)) # converts to SpatRaster
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.