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

adjacencyFromTransition

Adjacent cells


Description

Identify pairs of cells that are adjacent.

Usage

adjacencyFromTransition(x)

Arguments

x

TransitionLayer

Details

Extracts the indices of those cells that are connected (e.g. cells i,j that have a non-zero value in the transition matrix).

Cell numbers are unique indices of cells in the original grid. By convention, cell numbers start with 1 in the upper-left corner of the grid and increase from left to right and from top to bottom.

Value

A two column matrix with each row containing a pair of adjacent cells.

Author(s)

Jacob van Etten

See Also

Examples

library("raster")
r <- raster(nrows = 6, ncols = 7, 
            xmn = 0, xmx = 7, 
            ymn = 0, ymx = 6, 
            crs = "+proj=utm +units=m")
r[] <- runif(6 * 7)
tr <- transition(r, function(x) 1 / mean(x), 8)

aft <- adjacencyFromTransition(tr)

head(aft)

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.