Detect clumps (patches) of connected cells. Each clump gets a unique ID. NA and zero are used as background values (i.e. these values are used to seperate clumps). You can use queen's or king's case, using the directions argument. For larger files that are processed in chunks, the highest clump number is not necessarily equal to the number of clumps (unless you use argument gaps=FALSE).
Usage
clump(x, ...)
Arguments
x
A RasterLayer object
...
additional arguments. See Details.
Value
A new RasterLayer object (in the R environment), and in some cases the side effect of a new file on disk.
Details
This function requires that the igraph package is available.
The following additional arguments can be passed, to replace default values for this function
rll{
directions Integer. Which cells are considered adjacent? Default value is 8 (Queen's case), the only valid alternative is 4 (King's case)
gaps Logical. If TRUE (the default), there may be 'gaps' in the chunk numbers (e.g. you may have clumps with IDs 1, 2, 3 and 5, but not 4). If it is FALSE, these numbers will be recoded from 1 to n (4 in this example)
filename Output filename. Default = ''
format Character. Output file type. See writeRasterdatatype Character. Output data type; can be 'INT', 'FLT', or a complete datatype description, see dataTypeoverwrite Logical. If TRUE, "filename" will be overwritten if it exists
progress Character. "text", "window", or "" (the default, no progress bar)
}