SDMmodel2MaxEnt: SDMmodel2MaxEnt

Description Usage Arguments Value Author(s) Examples

View source: R/SDMmodel2MaxEnt.R

Description

Converts an SDMmodel object containing a Maxent model into a dismo MaxEnt object.

Usage

1

Arguments

model

SDMmodel object to be converted.

Value

The converted dismo MaxEnt object.

Author(s)

Sergio Vignali

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Acquire environmental variables
files <- list.files(path = file.path(system.file(package = "dismo"), "ex"),
                    pattern = "grd", full.names = TRUE)
predictors <- raster::stack(files)

# Prepare presence and background locations
p_coords <- virtualSp$presence
bg_coords <- virtualSp$background

# Create SWD object
data <- prepareSWD(species = "Virtual species", p = p_coords, a = bg_coords,
                   env = predictors, categorical = "biome")

# Train a Maxent model
# The next line checks if Maxent is correctly configured but you don't need
# to run it in your script
if (dismo::maxent(silent = TRUE)) {
model <- train(method = "Maxent", data = data, fc = "l")

dismo_model <- SDMmodel2MaxEnt(model)
dismo_model
}

SDMtune documentation built on July 17, 2021, 9:06 a.m.