View source: R/data_subsample.R
data_subsample | R Documentation |
Helper function to subsample occurrence data
data_subsample(data, replicates = 1, replicate_type = "bootstrap",
bootstrap_percentage = 50)
data |
data.frame of occurrence records. Columns must be longitude and latitude. |
replicates |
(numeric) number of subsamples to be produced. If
|
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 |
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.