Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rasterFromTransition

RasterLayer from TransitionLayer object


Description

Create a RasterLayer from a TransitionLayer with a call to the generic function raster. The n x n transition matrix of the TransitionLayer is transformed to form the values n cells of a raster.

Usage

## S4 method for signature 'TransitionLayer'
raster(x, reduceMethod = "NZcolMeans")

Arguments

x

a Transition* object

reduceMethod

character for the method to reduce the transition matrix. See details

Details

The following methods to ‘reduce’ the transition matrix are available with the optional argument reduceMethod):

  • colSums

  • rowSums

  • colMeans

  • rowMeans

  • NZcolMeans

  • NZrowMeans

The latter two methods only take into account the non-zero entries in the transition matrix. The default is NZcolMeans.

Value

a RasterLayer

Author(s)

Jacob van Etten

Examples

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

#create a Transition object from the raster
tr1 <- transition(r,mean,8)

#asymmetric
asf <- function(x) max(x) - x[1] + x[2]
tr2 <- transition(r,asf,8, symm=FALSE)

#create RasterLayer objects
r1 <- raster(tr1)
r2 <- raster(tr2)
r3 <- raster(tr1, "colMeans")

gdistance

Distances and Routes on Geographical Grids

v1.3-6
GPL (>= 2)
Authors
Jacob van Etten [aut] (<https://orcid.org/0000-0001-7554-2558>), Kauê de Sousa [cre, ctb] (<https://orcid.org/0000-0002-7571-7845>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.