model_projection: Helper function to project models to distinct scenarios

View source: R/model_projection.R

model_projectionR Documentation

Helper function to project models to distinct scenarios

Description

Helper function to project models to distinct scenarios

Usage

model_projection(ellipsoid, projection_variables, prvariables_format = NULL,
                 sp_name, prediction = "suitability", truncate = TRUE,
                 return_numeric = TRUE, tolerance = 1e-60, format = "GTiff",
                 overwrite = FALSE, force_return = FALSE, return_name = NULL,
                 output_directory = "ellipsenm_projections")

Arguments

ellipsoid

a fitted object of class ellipsoid*.

projection_variables

(RasterStack, list, or character): if RasterStack, a stack of layers respresenting an only scenario for projection; if list, a named list of RasterStacks representing multiple scenarios for projection; if character, name of the folder (in the working directory) containing other folders (scenarios for projection) with raster layers to be used as variables. See details of ellipsoid_model.

prvariables_format

(character) if projection_variables is a list, raster type of variables (raster layers) to be used and located in subdirectories. Default = NULL. See writeFormats for details and options.

sp_name

(character) name of the species for which model(s) will be projected. If not defined "species" is used.

prediction

(character) type of prediction to be made, options are: "suitability", "mahalanobis", and "both". Default = "suitability".

truncate

(logical) whether or not to truncate values of suitability based on ellipsoid limits. All values outside the ellipsoid will be zero. Default = TRUE.

return_numeric

(logical) whether or not to return values of mahalanobis distance and suitability as part of the results (it depends on the type of prediction selected). If projection_variables is a RasterStack, default = FALSE; if projection_variables is a matrix, default = TRUE. For both options the default can be changed. See details.

tolerance

the tolerance for detecting linear dependencies. Default = 1e-60.

format

(charater) raster type of layers to be written. See writeFormats for details and options.

overwrite

(logical) whether or not to overwrite an exitent file with the exact same name. Default = FALSE.

force_return

(logical) whether or not to force returning numeric and raster results for one of the ellipsoids defined by name in return_name. See details.

return_name

(character) names of the ellipsoid (part of ellipsoid) for which numeric and raster results will be forced to return. Default = NULL.

output_directory

name of the folder were all results will be written. This avoids saturation of the RAM.

Value

A list with an example of each of the following: raster layers of suitability or mahalanobis distances, depending on the type of prediction selected; and the prevalence in environemnetal and geographic space for all projection scenarios, if prediction was other than mahalanobis.

Additionally all results of projections will be written in the folder defined in output_directory.


marlonecobos/ellipsenm documentation built on Oct. 18, 2023, 8:09 a.m.