extremeValues: Minimum and maximum values

Description Usage Arguments Details Value Examples

Description

Returns the minimum or maximum value of a RasterLayer or layer in a RasterStack

Usage

1
2

Arguments

x

RasterLayer or RasterStack object

...

Additional argument: layer number (for RasterStack or RasterBrick objects)

Details

If a Raster* object is created from a file on disk, the min and max values are often not known (depending on the file format). You can use setMinMax to set them in the Raster* object.

Value

a number

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
r <- raster()
r <- setValues(r, 1:ncell(r))
minValue(r)
maxValue(r)
r <- setValues(r, round(100 * runif(ncell(r)) + 0.5))
minValue(r)
maxValue(r)

r <- raster(system.file("external/test.grd", package="raster"))
minValue(r)
maxValue(r)

Example output

Loading required package: sp
[1] 1
[1] 64800
[1] 1
[1] 100
[1] 128.434
[1] 1805.78

raster documentation built on Jan. 5, 2021, 3:01 a.m.