Learn R Programming

raster (version 1.8-3)

compare: Compare

Description

Evaluate whether a two or more rasters have the same extent, number of rows and columns, projection, resolution, and origin (or a subset of these comparisons). Cell values are not compared by this function.

Usage

compare(x, ..., extent=TRUE, rowcol=TRUE, prj=TRUE, res=FALSE, orig=FALSE, tolerance, stopiffalse=TRUE, showwarning=FALSE)

Arguments

x
A Raster* object
...
Additional Raster* objects
extent
Logical. If TRUE, bounding boxes are compared
rowcol
Logical. If TRUE, number of rows and columns of the objects are compared
prj
Logical. If TRUE projections are compared.
res
Logical. If TRUE, resolutions are compared (redundant when checking extent and rowcol)
orig
Logical. If TRUE, origins are compared
tolerance
Numeric, if not supplied, the default value of 0.05 is used. It sets difference (relative to the cell resolution) that is permissable for objects to be considered 'equal', if they have a non-integer origin or resolution. See
stopiffalse
Logical. If TRUE, an error will occur if the objects are not the same
showwarning
Logical. If TRUE, an warning will be given if objects are not the same. Only relevant when stopiffalse is TRUE

Examples

Run this code
r1 <- raster()
	r2 <- r1
	r3 <- r1
	compare(r1, r2, r3)
	nrow(r3) <- 10
#	compare(r1, r3)
	compare(r1, r3, stopiffalse=FALSE)
	compare(r1, r3, rowcol=FALSE)

Run the code above in your browser using DataLab