# 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, 9000)
nrow(bg_coords)
# Thin the locations
thinned_bg <- thinData(bg_coords, env = predictors)
nrow(thinned_bg)
# }
Run the code above in your browser using DataLab