compare.RdEvaluate whether a two or more Raster* objects have the same extent, number of rows and columns, projection, resolution, and origin (or a subset of these comparisons).
all.equal is a wrapper around compareRaster with options values=TRUE, stopiffalse=FALSE and showwarning=TRUE.
compareRaster(x, ..., extent=TRUE, rowcol=TRUE, crs=TRUE, res=FALSE, orig=FALSE,
rotation=TRUE, values=FALSE, tolerance, stopiffalse=TRUE, showwarning=FALSE)Raster* object
Raster* objects
logical. If TRUE, bounding boxes are compared
logical. If TRUE, number of rows and columns of the objects are compared
logical. If TRUE, coordinate reference systems are compared.
logical. If TRUE, resolutions are compared (redundant when checking extent and rowcol)
logical. If TRUE, origins are compared
logical. If TRUE, rotations are compared
logical. If TRUE, cell values are compared
numeric between 0 and 0.5. If not supplied, the default value is used (see rasterOptions. It sets difference (relative to the cell resolution) that is permissible for objects to be considered 'equal', if they have a non-integer origin or resolution. See all.equal.
logical. If TRUE, an error will occur if the objects are not the same
logical. If TRUE, an warning will be given if objects are not the same. Only relevant when stopiffalse is TRUE
r1 <- raster()
r2 <- r1
r3 <- r1
compareRaster(r1, r2, r3)
#> [1] TRUE
nrow(r3) <- 10
# compareRaster(r1, r3)
compareRaster(r1, r3, stopiffalse=FALSE)
#> [1] FALSE
compareRaster(r1, r3, rowcol=FALSE)
#> [1] TRUE
all.equal(r1, r2)
#> [1] TRUE
all.equal(r1, r3)
#> Warning: different number or rows
#> [1] FALSE