Learn R Programming

terra (version 1.8-5)

add: Add (in place) a SpatRaster to another SpatRaster or to a SpatRasterDataset or SpatRasterCollection

Description

Add (in place) a SpatRaster to another SpatRaster. Comparable with c, but without copying the object.

Usage

# S4 method for SpatRaster,SpatRaster
add(x)<-value

# S4 method for SpatRasterDataset,SpatRaster add(x)<-value

# S4 method for SpatRasterCollection,SpatRaster add(x)<-value

Value

SpatRaster

Arguments

x

SpatRaster, SpatRasterDataset or SpatRasterCollection

value

SpatRaster

See Also

Examples

Run this code
r <- rast(nrows=5, ncols=9, vals=1:45)
x <- c(r, r*2)
add(x) <- r*3
x

Run the code above in your browser using DataLab