kuenm_occsplit: Split occurrence files in training and testing data

View source: R/kuenm_occsplit.R

kuenm_occsplitR Documentation

Split occurrence files in training and testing data

Description

kuenm_occsplit splits occurrences contained in a data.frame to obtain training and testing data based on distinct methods for calibrating models.

Usage

kuenm_occsplit(occ, train.proportion = 0.5, method = "random",
               save = FALSE, name = "occ")

Arguments

occ

data.frame of occurrence records containing at least species, longitude, and latitude columns.

train.proportion

(numeric) proportion (from 0 to 1) of data to be used as training occurrences. The remaining data will be used for testing.

method

(character) method for selecting training and testing occurrences. Current option is "random".

save

(logical) whether or not to save the results in the working directory. Default = FALSE.

name

(character) common name for csv files to be written. A suffix will be added depending on if the data is the complete set, training set, or testing set of occurrences.

Value

List with all, training, and testing occurrences. Three csv files will be written in the working directory according to the name defined in name plus the suffix _joint for all records, _train for the training set, and _test for the testing set.

Examples

# arguments
data("sp_joint", package = "kuenm")

occs <- data.frame(Species = "A_americanum", sp_joint)
train_prop <- 0.5
method = "random"

# running
data_split <- kuenm_occsplit(occ = occs, train.proportion = train_prop,
                             method = method)

manubio13/ku.enm documentation built on Jan. 5, 2024, 5:55 a.m.