Assess whether a list of extents are all equal

equalExtent(extents)

# S4 method for list
equalExtent(extents)

Arguments

extents

list of extents objects

Author

Eliot McIntire

Examples

library(igraph)
#> 
#> Attaching package: ‘igraph’
#> The following object is masked from ‘package:raster’:
#> 
#>     union
#> The following objects are masked from ‘package:stats’:
#> 
#>     decompose, spectrum
#> The following object is masked from ‘package:base’:
#> 
#>     union
library(raster)

files <- system.file("maps", package = "quickPlot") %>%
  dir(., full.names = TRUE, pattern = "tif")
maps <- lapply(files, function(x) raster(x))
names(maps) <- sapply(basename(files), function(x) {
  strsplit(x, split = "\\.")[[1]][1]
})
extnts <- lapply(maps, extent)
equalExtent(extnts) ## TRUE
#> [1] TRUE