Learn R Programming

raster (version 1.3-11)

Arith-methods: Arithmic with Raster* objects

Description

Standard arithmic operators for computations with Raster* objects and numeric values. The following operators are available: +, -, *, /, ^, %%, %/% Operators are applied on a cell by cell basis, and single numeric values are recycled. Input RasterLayers must have the same extent and resolution.

Arguments

Value

  • A Raster* object, and in some cases the side effect of a new file on disk.

Details

If the values of the output Raster* cannot be held in memory, they will be saved to a temporary file. You can use rasterOptions to set the default file format, datatype and progress bar.

See Also

Math-methods, overlay, calc

Examples

Run this code
r1 <- raster(ncols=10, nrows=10)
r1[] <- runif(ncell(r1))
r2 <- setValues(r1, 1:ncell(r1) / ncell(r1) )
r3 <- r1 + r2
r2 <- r1 / 10
r3 <- r1 * (r2 - 1 + r1^2 / r2)
b <- brick(r1, r2, r3)
b <- b * 10

Run the code above in your browser using DataLab