Arith-methods: Arithmetic and mathematical operations with objects of...

Description Value Author(s) Examples

Description

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.

Value

Transition* object or numeric.

Author(s)

Jacob van Etten

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
  #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)
  tr2 <- tr1

  #arithmetic operations
  tr3 <- tr1 * tr2
  tr4 <- tr3 * 4
  
  #mathematical operations
  tr5 <- sqrt(tr4)

gdistance documentation built on May 2, 2019, 5:46 p.m.