sieve.RdApply a sieve filter. That is, remove "noise", by changing small clumps of cells with a value that is different from the surrounding cells, to the value of the largest neighboring clump.
Note that the numerical input values are truncated to integers.
# S4 method for class 'SpatRaster'
sieve(x, threshold, directions=8, filename="", ...)SpatRaster, single layer with integer or categorical values
positive integer. Only clumps smaller than this threshold will be removed
numeric to indicate which cells are connected. Either 4 to only consider the horizontal and vertical neighbors ("rook"), or 8 to consider the vertical, horizontal and diagonal neighbors
character. Output filename
Options for writing files as in writeRaster