Learn R Programming

SDMtune (version 0.2.1)

getSubsample: Get Dataset Subsample, Deprecated

Description

Get a random subsample of an '>SWD object. This function is deprecated, don't use it with the an SWD object that contains presence and absence/background locations together.

Usage

getSubsample(dataset, size, seed = NULL)

Arguments

dataset

'>SWD object.

size

numeric. The size of the sub sample.

seed

numeric. The value used to set the seed in order to have consistent results, default is NULL.

Value

The sub sample as '>SWD object.

Examples

Run this code
# NOT RUN {
# Acquire environmental variables
files <- list.files(path = file.path(system.file(package = "dismo"), "ex"),
                    pattern = "grd", full.names = TRUE)
predictors <- raster::stack(files)

# Prepare background locations
bg_coords <- dismo::randomPoints(predictors, 5000)

# Create SWD object
bg <- prepareSWD(species = "Virtual species", a = bg_coords, env = predictors,
                 categorical = "biome")

# Get a subsample
getSubsample(bg, size = 2000, seed = 25)
# }

Run the code above in your browser using DataLab