modal | R Documentation |
Compute the mode for each cell across the layers of a SpatRaster. The mode, or modal value, is the most frequent value in a set of values.
## S4 method for signature 'SpatRaster'
modal(x, ..., ties="first", na.rm=FALSE, filename="", overwrite=FALSE, wopt=list())
x |
SpatRaster |
... |
additional argument of the same type as |
ties |
character. Indicates how to treat ties. Either "random", "lowest", "highest", "first", or "NA" |
na.rm |
logical. If |
filename |
character. Output filename |
overwrite |
logical. If |
wopt |
list with named options for writing files as in |
SpatRaster
r <- rast(system.file("ex/logo.tif", package="terra"))
r <- c(r/2, r, r*2)
m <- modal(r)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.