cclFun: Connected Component Labeling

View source: R/cclFun.R

cclFunR Documentation

Connected Component Labeling

Description

This routine identifies disjunct patches within a distribution matrix.

Usage

cclFun(mat)

Arguments

mat

Matrix with 0 as background value and positive values as occurrences to check patches for.

Details

This routine identifies disjunct patches of positive values within a matrix containing zeros as background values.

Value

This function returns a matrix with zero as background value and positive values numbering and representing the disjunct patches.

Author(s)

Maximilian Lange

Examples

## example data
tmat = { matrix(c( 0,0,0,1,0,0,1,1,0,1,
                   0,0,1,0,1,0,0,0,0,0,
                   0,1,NA,1,0,1,0,0,0,1,
                   1,0,1,1,1,0,1,0,0,1,
                   0,1,0,1,0,1,0,0,0,1,
                   0,0,1,0,1,0,0,1,1,0,
                   1,0,0,1,0,0,1,0,0,1,
                   0,1,0,0,0,1,0,0,0,1,
                   0,0,1,1,1,0,0,0,0,1,
                   1,1,1,0,0,0,0,0,0,1),
		nr=10,byrow=TRUE) }

ccl.mat <- cclFun(tmat)

sperich documentation built on July 26, 2023, 5:49 p.m.

Related to cclFun in sperich...