Last chance! 50% off unlimited learning
Sale ends in
Last chance! 50% off unlimited learning
Sale ends in
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
).clump(x, ...)
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 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. "text", "window", or "" (the default, no progress bar)
}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 DataLab