if_raster | R Documentation |
if_raster
is used to permit flexibility in the use of SpatRasts, matrices or arrays in many functions.
if_raster(x, r)
x |
an R object |
r |
an R object |
if r
is a SpatRaster, x
is converted to a SpatRaster with the same attributes as r
, otherwise returns x
r <- is_raster(dtm100m)
r1 <- if_raster(r, dtm100m)
r2 <- if_raster(r, r)
class(r1) # is a SpatRaster
class(r2) # is a matrix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.