clamp | R Documentation |
Clamp values to a minimum and maximum value. That is, all values below the lower clamp value and above the upper clamp value become NA (or the lower/upper value if useValue=TRUE
)
## S4 method for signature 'Raster'
clamp(x, lower=-Inf, upper=Inf, useValues=TRUE, filename="", ...)
## S4 method for signature 'numeric'
clamp(x, lower=-Inf, upper=Inf, ...)
x |
RasterLayer, or numeric vector |
lower |
numeric. lowest value |
upper |
numeric. highest value |
useValues |
logical. If |
filename |
character. Filename for the output RasterLayer (optional) |
... |
additional arguments as for |
Raster object
reclassify
r <- raster(ncols=12, nrows=12)
values(r) <- 1:ncell(r)
rc <- clamp(r, 25, 75)
rc
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.