View source: R/findsmallpatches.R
findsmallpatches | R Documentation |
This function returns a grid of the same extent as x populated with TRUE and FALSE indicating whether each cells is part of a small patch and within one of the targetclasses
findsmallpatches(x, maxsize, nr=8, ...)
## S3 method for class 'grid'
findsmallpatches(x, maxsize, nr = 8, ...)
## S3 method for class 'matrix'
findsmallpatches(x, maxsize, nr = 8, targetclasses = NA,...)
x |
a grid object |
nr |
the neighbor rule to use when identifying small patches; should be either 4 or 8 |
maxsize |
the maximum number of cells a patch can have and be considered small |
targetclasses |
a vector indicating classes to process; if set only cells in the target classes will be eligable to be identified as small; if NA all classes are considered. |
... |
arguments passed on to other methods |
This function returns a logical grid with TRUE anwhere a small patch exists within a target class and FALSE elsewhere.
Ethan Plunkett
eliminatesmallpatches
uses this function to remove small patches and replace with values
from nearby cells patchscan
is used by this function to identify patches.
g <- asgrid(matrix(runif(n = 48)> .7, 6, 8), xll = 0, yll = 0, cellsize = 10)
plot(g)
plot(findsmallpatches(g, 3, nr = 8)) # TRUE (1) where g has small patches
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.