These all create a single function that can be used for either Raster or SpatRaster objects.

.NAvalueFlag(ras, NAval)

.stack(rasList)

.projectExtent(ras, crs)

asInt(ras)

isInt(ras)

reclass(ras, tab)

Arguments

ras

a Raster, or SpatRaster object

NAval

the value to use as NA

rasList

a list of Raster or SpatRaster objects

crs

passed to raster::projectRaster(..., crs = crs) and terra::project(..., y = crs)

tab

matrix of values to reclassify. See terra::classify and raster::reclassify.

Value

a raster with attributed NA values

a stacked raster

the projected extent

asInt returns a *Raster with values converted to integer, if they weren't already.

isInt returns a logical as per is.integer.

reclass returns a *Raster with values reclassified as per terra::classify

and raster::reclassify.