Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

prepareSWD

Prepare an SWD object


Description

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

Usage

prepareSWD(species, env, p = NULL, a = NULL, categorical = NULL)

Arguments

species

character. The name of the species.

env

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

p

data.frame. The coordinates of the presence locations.

a

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

categorical

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

Details

The SWD object is created in a way that the presence locations are always before than the absence/background locations.

Value

An SWD object.

Author(s)

Sergio Vignali

Examples

# 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 the SWD object
data <- prepareSWD(species = "Virtual species", p = p_coords, a = bg_coords,
                   env = predictors, categorical = "biome")
data

SDMtune

Species Distribution Model Selection

v1.1.4
GPL-3
Authors
Sergio Vignali [aut, cre] (<https://orcid.org/0000-0002-3390-5442>), Arnaud Barras [aut] (<https://orcid.org/0000-0003-0850-6965>), Veronika Braunisch [aut] (<https://orcid.org/0000-0001-7035-4662>), Conservation Biology - University of Bern [fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.