Standard arithmetic operators for computations with Transition* objects and numeric values. Transition objects must have the same extent and resolution. All arithmetic and mathematical operations that work on the sparse matrices are available for Transition* objects.

# S4 method for TransitionLayer,TransitionLayer
Arith(e1, e2)

Arguments

e1

objects

e2

objects

Value

a Transition* object or numeric.

Author

Jacob van Etten

Examples

#create a new raster and set all its values to unity.
raster <- raster(nrows=18, ncols=36)
raster <- setValues(raster,rep(1,ncell(raster)))

#create TransitionLayer objects
tr1 <- transition(raster,mean,4)
#> The extent and CRS indicate this raster is a global lat/lon raster. This means that transitions going off of the East or West edges will 'wrap' to the opposite edge.
#> Global lat/lon rasters are not supported under new optimizations for 4 and 8 directions with custom transition functions. Falling back to old method.
tr2 <- tr1

#arithmetic operations
tr3 <- tr1 * tr2
tr4 <- tr3 * 4

#mathematical operations
tr5 <- sqrt(tr4)