raster (version 1.0.4)

clump: Detect clumps

Description

Detect clumps (patches) of connected cells. Each clump gets a unique ID. NA and zero are used as backaground values (i.e. these values are used to seperate clumps)

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 is quite slow. It is much quicker for files that can be loaded into memory, particularly when the igraph package is available. The following additional arguments can be passed, to replace default values for this function rll{ filename Output filename. Default = '' format Character. Output file type. See writeRaster datatype Character. Output data type; can be 'INT', 'FLT', or a complete datatype description, see dataType overwrite Logical. If TRUE, "filename" will be overwritten if it exists progress Character. Valid values are "text", "tcltk", "windows" (on that platform only) and "" }

Examples

Run this code
r <- raster(ncols=10, nrows=10)
r[] <- round(runif(ncell(r))*0.6 )
rc <- clump(r) 
freq(rc)
#plot(rc)

Run the code above in your browser using DataCamp Workspace