Learn R Programming

gdistance (version 1.2-2)

Transition* methods: Extracting and replacing: class Transition

Description

Methods for functions [ and [<- for object of the class TransitionLayer. Methods for functions [[ and [[<- for object of the class TransitionStack.

Also see adjacencyFromTransition.

Arguments

Examples

Run this code
# NOT RUN {
  #Create a new raster and set all its values to unity.
  r <- raster(nrows=18, ncols=36) 
  r <- setValues(r,rep(1,ncell(r)))

  #Create TransitionLayer objects
  tr1 <- transition(r,mean,4)
  tr2 <- tr1

  #Extracting and replacing
  tr1[cbind(1:9,1:9)] <- tr2[cbind(1:9,1:9)]
  tr1[1:9,1:9] <- tr2[1:9,1:9]
  tr1[1:5,1:5]
# }

Run the code above in your browser using DataLab