splitData: Splits presence locations into training and testing data sets...

Description Usage Arguments Details Value Examples

View source: R/splitData.R

Description

splitData Uses a user-defined precentage to split presence locations into training and testing datasets. Both are output as .csv files (need to be converted to .xls for use in the desktop version of GARP) and a shapefile object (for testing using aucGARP).

Usage

1
2
3
4
5
6
7
8
9
splitData(
  points,
  p,
  type = c("train", "test", "all"),
  iterations = 1,
  output = TRUE,
  output.path,
  output.name
)

Arguments

points

a data.frame object containing latitude and longitude values of presence locations

p

a numeric value specifying the precentage of locations to keep for training

type

a character value specifying which points should be returned: training ("train"), testing ("test"), or both ("all")

iterations

a numeric value specifying how many resampling events should be run; defaults to 1

output

logical. Should the datasets be saved to file?

output.path

a file path specifying the file name of the objects to be saved. "_train" or "_test" will be appended to file name (e.g. "C:/Users/")

output.name

the file name of the objects to be saved. "_train" or "_test" will be appended to file name (e.g. "Homo_sapiens_test.shp")

Details

Use the iterations element when performing multiple experiments in GARP. The function will return a single .csv datasheet with all training data combined for use by GARP, with the "Species" vector containing the species name from the points object with the iteration number attached (e.g. "Homo_sapiens1_train", "Homo_sapiens2_train", "Homo_sapiens3_train", etc.).

Value

A list object containing data.frames for training locations (when type = "train"), testing locations (when type = "test"), or both (when type = "all"). When output = TRUE, outputs both a .csv and shapefile to specified file path.

Examples

1
2
3
4
5
## Not run: 
  hs <- data.frame("Latitude" = c(-89, 72, 63, 42, 54), "Longitude" = c(-12, 13, 24, 26, 87), "Species" = rep("Homo sapiens", 5))
  splitData(points = hs, p = 0.7, type = "all", output.path = "C/GARP", output.name = "Homo_sapiens")

## End(Not run)

cghaase/GARPTools documentation built on Aug. 6, 2021, 6:38 a.m.