# 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