Description Value See Also Examples

The following summary methods are available for Raster* objects:

`mean, max, min, range, prod, sum, any, all`

All methods take `na.rm`

as an additional logical argument. Default is `na.rm=FALSE`

. If `TRUE`

, `NA`

values are removed from calculations.
These methods compute a summary statistic based on cell values of RasterLayers and the result of these methods is always a single RasterLayer (except for range, which returns a RasterBrick with two layers). See `calc`

for functions not included here (e.g. median) or any other custom functions.

You can mix RasterLayer, RasterStack and RasterBrick objects with single numeric or logical values. However, because generic functions are used, the method applied is chosen based on the first argument: '`x`

'. This means that if `r`

is a RasterLayer object, `mean(r, 5)`

will work, but `mean(5, r)`

will not work.

To summarize all cells within a single RasterLayer, see `cellStats`

and `maxValue`

and `minValue`

a RasterLayer

1 2 3 4 5 6 7 8 9 |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.