departure | R Documentation |
This function quantifies the amount of change between historical and future climate conditions inside a species' habitat.
departure(x, y, s.dat, ...)
## S4 method for signature 'GLdeparture,missing,cnfa'
departure(x, s.dat, filename = "", ...)
## S4 method for signature 'GLdeparture,missing,Spatial'
departure(x, s.dat, field, fun = "last", filename = "", ...)
## S4 method for signature 'Raster,Raster,cnfa'
departure(
x,
y,
s.dat,
center = TRUE,
scale = TRUE,
filename = "",
progress = FALSE,
parallel = FALSE,
n = 1,
...
)
## S4 method for signature 'Raster,Raster,Spatial'
departure(
x,
y,
s.dat,
center = TRUE,
scale = TRUE,
filename = "",
progress = FALSE,
parallel = FALSE,
n = 1,
...
)
x |
Raster* object, typically a brick or stack of historical climate raster layers or a brick of absolute differences (see Details) |
y |
Raster* object, future climate values with the same layers as |
s.dat |
SpatialPolygons*, sf, or cnfa object detailing species presence |
... |
Additional arguments for |
filename |
character. Optional filename to save the Raster* output to
file. If this is not provided, a temporary file will be created for large |
field |
field of |
fun |
function or character. Determines what values to assign to cells
with multiple spatial features, similar to the |
center |
logical. If |
scale |
logical. If |
progress |
logical. If |
parallel |
logical. If |
n |
numeric. Optional number of CPU cores to utilize for parallel processing |
For comparisons of multiple species in the same study area, it is much more
efficient to first construct a Raster* object of absolute differences between
the historical and future values, so that the differences do not need to be
recalculated for each species. This can be achieved with by passing x
and y
to the difRaster
function, and then passing the
results to the departure
function.
When only one Raster* object is supplied, it is assumed that x
is
a Raster* object containing the absolute differences of a historical and
future dataset.
Returns an S4 object of class departure
with the following slots:
Original function call
Departure factor. Vector of length p that describes the amount of departure between future and historical conditions for each climate variable
Magnitude of the departure factor
p x p historical global covariance matrix
RasterBrick of climate departures, with p layers
Raster layer of weights used for departure calculation
Rinnan, D. Scott and Lawler, Joshua. Climate-niche factor analysis: a spatial approach to quantifying species vulnerability to climate change. Ecography (2019): <doi:10.1111/ecog.03937>.
dep1 <- departure(x = climdat.hist, y = climdat.fut, s.dat = ABPR, field = "CODE")
# using difRaster as an initial step
# for multi-species comparison
gld <- GLdeparture(x = climdat.hist, y = climdat.fut)
dep2 <- departure(x = gld, s.dat = ABPR, field = "CODE")
# same results either way
all.equal(dep1@df, dep2@df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.