Learn R Programming

SDMtune (version 0.1.0)

prepareSWD: Prepare an SWD object

Description

Given the coordinates, the species' name and the environmental variables, the function creates a '>SWD object (sample with data).

Usage

prepareSWD(species, coords, env, categorical = NULL)

Arguments

species

character. The name of the species.

coords

data.frame. The coordinates of the presence or absence/background locations.

env

stack containing the environmental variables used to extract the values at coordinate locations.

categorical

vector indicating which of the environmental variable are categorical, default is NULL.

Value

A '>SWD 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 locations
p_coords <- condor[, 1:2]

presence <- prepareSWD(species = "Vultur gryphus", coords = p_coords,
                       env = predictors, categorical = "biome")
presence
# }

Run the code above in your browser using DataLab