data_subsample: Helper function to subsample occurrence data

View source: R/data_subsample.R

data_subsampleR Documentation

Helper function to subsample occurrence data

Description

Helper function to subsample occurrence data

Usage

data_subsample(data, replicates = 1, replicate_type = "bootstrap",
               bootstrap_percentage = 50)

Arguments

data

data.frame of occurrence records. Columns must be longitude and latitude.

replicates

(numeric) number of subsamples to be produced. If replicate_type = "jackknife" the maximum number of subsamples produced equal the number of records in data. Default = 1 returns the complete set of data as the only element of a list.

replicate_type

(character) name of the sampling method to be used. Options are "bootstrap" or "jackknife". Default = "bootstrap".

bootstrap_percentage

(numeric) percentage of data to be bootstrapped for each replicate. Default = 50. Valid if replicates > 1 and replicate_type = "bootstrap".

Examples

# reading data
occurrences <- read.csv(system.file("extdata", "occurrences.csv",
                                    package = "ellipsenm"))

# subsampling by bootstrap
subsamples <- data_subsample(data = occurrences[, -1], replicates = 5,
                             replicate_type = "bootstrap", bootstrap_percentage = 70)

lapply(subsamples, head)
lapply(subsamples, dim)

# subsampling by "jackknife" one record out at the time
subsamples1 <- data_subsample(data = occurrences[, -1], replicates = 5,
                              replicate_type = "jackknife")

lapply(subsamples1, head)
lapply(subsamples1, dim)

marlonecobos/ellipsenm documentation built on Oct. 18, 2023, 8:09 a.m.