Merge Raster* objects to form a new Raster object with a larger spatial extent. If objects overlap, the values get priority in the same order as the arguments, but NA values are ignored (except when overlap=FALSE)
Usage
## S3 method for class 'Raster,Raster':
merge(x, y, ..., tolerance=0.05, filename="", overlap=TRUE, ext=NULL)
## S3 method for class 'RasterStackBrick,missing':
merge(x, ..., tolerance=0.05, filename="", ext=NULL)
## S3 method for class 'Extent,ANY':
merge(x, y, ...)
Arguments
x
Raster* or Extent object
y
Raster* if x is a Raster* object (or missing). If x is an Extent, y can be an Extent or object from which an Extent can be extracted
...
additional Raster or Extent objects (and/or arguments for writing files as in writeRaster)
tolerance
numeric. permissible difference in origin (relative to the cell resolution). See all.equal
filename
character. Output filename (optional)
overlap
logical. If FALSE values of overlapping objects are based on the first layer, even if they are NA
ext
Extent object (optional) to limit the output to that extent
Value
RasterLayer or RasterBrick
Details
The Raster objects must have the same origin and resolution. In areas where the Raster objects overlap, the values of the Raster object that is first in the sequence of arguments will be retained. If you would rather use the average of cell values, or do another computation, you can use mosaic instead of merge.