Learn R Programming

intSDM (version 2.1.1)

sdmWorkflow: sdmWorkflow: Function to compile the reproducible workflow.

Description

This function is used to compile the reproducible workflow from the R6 object created with startFunction. Depending on what was specified before, this function will estimate the integrated species distribution model, perform cross-validation, create predictions from the model and plot these predictions.

Usage

sdmWorkflow(
  Workflow = NULL,
  predictionDim = c(150, 150),
  predictionData = NULL,
  initialValues = FALSE,
  inlaOptions = list(),
  ipointsOptions = NULL
)

Value

The return of the function depends on the argument Save from the startWorkflow function. If this argument is FALSE then the objects will be saved to the specidfied directory. If this argument is TRUE then a list of different outcomes from the workflow will be returned.

Arguments

Workflow

The R6 object created from startWorkflow. This object should contain all the data and model information required to estimate and specify the model.

predictionDim

The pixel dimensions for the prediction maps. Defaults to c(150, 150).

predictionData

Optional argument for the user to specify their own data to predict on. Must be a sf or SpatialPixelsDataFrame object. Defaults to NULL.

initialValues

Find initial values using a GLM before the model is estimated. Defaults to FALSE.

inlaOptions

Options to specify in inla from the inla function. See ?inla for more details.

ipointsOptions

Options to specify in fm_int's int.args argument. See ?fmesher::fm_int for more details.

Examples

Run this code
if (FALSE) {
if (requireNamespace('INLA')) {

workflow <- startWorkflow(Species = 'Fraxinus excelsior',
                          Projection = '+proj=longlat +ellps=WGS84',
                          Save = FALSE,
                          saveOptions = list(projectName = 'example'))
workflow$addArea(countryName = 'Sweden')

workflow$addGBIF(datasetName = 'exampleGBIF',
                 datasetType = 'PA',
                 limit = 10000,
                 coordinateUncertaintyInMeters = '0,50')
workflow$addMesh(cutoff = 20000,
                 max.edge=c(60000, 80000),
                 offset= 100000)
workflow$workflowOutput('Model')

Model <- sdmWorkflow(workflow)

}
}

Run the code above in your browser using DataLab