Learn R Programming

SDMtune (version 1.1.0)

SDMmodel2MaxEnt: SDMmodel2MaxEnt

Description

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

Usage

SDMmodel2MaxEnt(model)

Arguments

model

'>SDMmodel object to be converted.

Value

The converted dismo '>MaxEnt object.

Examples

Run this code
# NOT RUN {
# 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
model <- train(method = "Maxent", data = data, fc = "l")

dismo_model <- SDMmodel2MaxEnt(model)
dismo_model
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab