# Acquire environmental variables
files <- list.files(path = file.path(system.file(package = "dismo"), "ex"),
pattern = "grd",
full.names = TRUE)
predictors <- terra::rast(files)
# Prepare background locations
bg_coords <- terra::spatSample(predictors,
size = 9000,
method = "random",
na.rm = TRUE,
xy = TRUE,
values = FALSE)
# Create SWD object
bg <- prepareSWD(species = "Virtual species",
a = bg_coords,
env = predictors,
categorical = "biome")
# Plot heat map
plotCor(bg,
method = "spearman")
# Plot heat map showing only values higher than given threshold and change
# text size
plotCor(bg,
method = "spearman",
cor_th = 0.8,
text_size = 4)
Run the code above in your browser using DataLab