futureOverlap {changeRangeR}R Documentation

Calculate the ratio of future overlap of SDMs with shapefile categories

Description

Calculate future overlap of SDMs with shapefile categories

Usage

futureOverlap(r, futures, field, category, r.names, futures.names)

Arguments

r

list of rasters of binary SDMs

futures

List of SpatialPolygons* objects with same CRS as r

field

The shapefile field attribute containing the features to compare (i.e., the column name).

category

a list of the names of shapefile features to compare. If all features are to be used, input "All".

r.names

list of character values of the names representing each raster in r

futures.names

list of character values of the names representing each SpatialPolygons* object in futures.

Value

a matrix showing the overlap between raster names and features.

Examples

#create rasters
r1 <- raster::raster(nrows=108, ncols=108, xmn=-50, xmx=50)
raster::values(r1)<- runif(n = (108*108))
r2 <- r1 >=0.5
r2[r2<1] <- NA
r3 <- r1 >=0.75
r3[r3<1] <- NA
# Create r
r <- list(r2, r3)
# create r.names
r.names <- c('scenario 1', 'scenario 2')
# create futures
coords <- dismo::randomPoints(r1, 3)
future <- sp::Polygon(coords)
future <- sp::SpatialPolygons(list(sp::Polygons(list(future), ID = "a")))
futures <- list(future, future)
futures.names <- list("fut1", "fut2")
# set field and category
field = "a"
category = "All"
# run function
futureOverlap(r, futures, field, category, r.names, futures.names)

[Package changeRangeR version 1.1.0 Index]