mAdjacency: Adjacency of cells

Description Usage Arguments Details Value See Also Examples

View source: R/measure.operators.R

Description

Calculate the cell-adjacency matrix for a raster

Usage

1
mAdjacency(obj, type = "like", count = "double", layer = NULL)

Arguments

obj

[Raster*(1)]
The object to measure.

type

[character(1)]
which type of adjacencies to calculate; either "like" adjacencies between cells of the same value, adjacencies between "paired" values or the rowsum of the paired values ("pairedSum").

count

[character(1)]
the cells that should be counted; possible values are "single" to count only cells to the right and bottom of the focal cell and "double" to count additionally cells to the left and top of the focal cell.

layer

[character(1)]
in case obj has several layers, specify here the layer for which the adjacency shall be calculated (by default, the first layer).

Details

In case type = "like", only the diagonal of the adjacency matrix is returned, in case type = "paired", the complete adjacency matrix is returned.

Value

a data.frame of the frequency of adjacencies of the values in obj.

See Also

Other generic metrics: mArea, mNumber, mPerimeter, mValues

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
cat <- rtData$categorical
bin <- rBinarise(rtData$continuous, thresh = 40)

# double count like adjacencies
mAdjacency(obj = cat)

# paired adjacencies
mAdjacency(obj = cat, type = "paired")

# adjacencies with single count
mAdjacency(obj = bin, count = "single")

EhrmannS/rasterTools documentation built on Feb. 4, 2019, 11:22 a.m.