Learn R Programming

SDMtune (version 0.1.0)

getSubsample: Get Dataset Subsample

Description

Get a random subsample of an '>SWD object.

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 = "Vultur gryphus", coords = bg_coords,
                 env = predictors, categorical = "biome")

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

Run the code above in your browser using DataLab