clamp

0th

Percentile

Clamp values

Clamp values to a mininum and maximum value. That is, all values below the lower clamp value and the upper clamp value become NA (or the lower/upper value if useValue=TRUE)

Keywords
spatial
Usage
# S4 method for Raster
clamp(x, lower=-Inf, upper=Inf, useValues=TRUE, filename="", ...)
# S4 method for numeric
clamp(x, lower=-Inf, upper=Inf, ...)
Arguments
x

RasterLayer, or numeric vector

lower

numeric. lowest value

upper

numeric. highest value

useValues

logical. If FALSE values outside the clamping range become NA, if TRUE, they get the extreme values

filename

character. Filename for the output RasterLayer (optional)

...

additional arguments as for writeRaster

Value

Raster object

See Also

reclassify

Aliases
  • clamp
  • clamp,Raster-method
  • clamp,numeric-method
Examples
library(raster) # NOT RUN { r <- raster(ncols=12, nrows=12) values(r) <- 1:ncell(r) rc <- clamp(r, 25, 75) rc # }
Documentation reproduced from package raster, version 2.6-7, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.