prepare_swd | R Documentation |
prepare_swd helps to create csv files containing occurrence records (all, train, and test records) and background coordinates, together with values of predictor variables, that later can be used to run model calibration in Maxent using the SWD format.
prepare_swd(occ, species, longitude, latitude, data.split.method = "random",
train.proportion = 0.5, raster.layers, sample.size = 10000,
var.sets = NULL, min.number = 2, save = FALSE, name.occ,
back.folder, set.seed = 1)
occ |
data.frame containing occurrence records of the species of interest. Mandatory columns are: species, longitude, and latitude. Other columns will be ignored. |
species |
(character) name of column containing species name. |
longitude |
(character) name of column containing longitude values. |
latitude |
(character) name of column containing latitude values. |
data.split.method |
(character) name of the method to split training and testing records. Default and only option for now = "random". |
train.proportion |
(numeric) proportion of records to be used for training models. Default = 0.5 |
raster.layers |
RasterStack of predictor variables masked to the area where the model will be calibrated. |
sample.size |
(numeric) number of points to represent the background for the model. Default = 10000 |
var.sets |
(character or list) if character the only option is "all_comb",
which will prepare the background to obtain all potential combinations of
variables considering the ones in |
min.number |
(numeric) minimum number of variables per set when option
"all_comb" is used in |
save |
(logical) whether or not to write csv files containing all, train, and test occurrences, as well as the background. All files will contain additional columns with the values of the variables for each coordinate. Default = FALSE. |
name.occ |
(character) name to be used for files with occurrence records. Only one name is needed, a sufix will be added to represent all (_join), _train, and _test records (e.g., "occurrences"). |
back.folder |
name for the csv file containing background coordinates (e.g., "background"). |
set.seed |
seed to be used when sampling background and splitting records. Default = 1 |
# data
data("sp_joint", package = "kuenm")
occ <- data.frame(Species = "A_americanum", sp_joint)
mvars <- raster::stack(list.files(system.file("extdata", package = "kuenm"),
pattern = "Mbio_", full.names = TRUE))
# preparing swd data one set of variables
prep <- prepare_swd(occ, species = "Species", longitude = "Longitude",
latitude = "Latitude", raster.layers = mvars,
sample.size = 5000)
# various sets of variables
preps <- prepare_swd(occ, species = "Species", longitude = "Longitude",
latitude = "Latitude", raster.layers = mvars,
var.sets = "all_comb", min.number = 3,
sample.size = 5000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.