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

swd2csv

SWD to csv


Description

Save an SWD object as csv file.

Usage

swd2csv(swd, file_name)

Arguments

swd

SWD object.

file_name

character. The name of the file in which to save the object, see details.

Details

  • The file_name argument should include the extension (i.e. my_file.csv).

  • If file_name is a single name the function saves the presence absence/background locations in a single file, adding the column pa with 1s for presence and 0s for absence/background locations. If file_name is a vector with two names, it saves the object in two files: the first name is used for the presence locations and the second for the absence/background locations.

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 SWD object
data <- prepareSWD(species = "Virtual species", p = p_coords, a = bg_coords,
                   env = predictors, categorical = "biome")
## Not run: 
# The following commands save the output in the working directory
# Save the SWD object as a single csv file
swd2csv(data, "train_data.csv")

# Save the SWD object in two separate csv files
swd2csv(data, c("presence.csv", "absence.csv"))

## End(Not run)

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.