# NOT RUN {
if(interactive()){
# load package data
awt <- raster::brick(system.file("extdata", "awt.grd", package = "blockCV"))
# import presence-absence species data
PA <- read.csv(system.file("extdata", "PA.csv", package = "blockCV"))
# make a sf object from data.frame
pa_data <- sf::st_as_sf(PA, coords = c("x", "y"), crs = raster::crs(awt))
# spatial blocking by specified range and random assignment
sb <- spatialBlock(speciesData = pa_data,
species = "Species",
rasterLayer = awt,
theRange = 70000,
k = 5,
selection = "random",
iteration = 100)
foldExplorer(sb, awt, pa_data)
# buffering with presence-absence data
bf <- buffering(speciesData= pa_data,
species= "Species", # to count the number of presences and absences
theRange= 70000,
spDataType = "PA",
progress = TRUE)
foldExplorer(bf, awt, pa_data)
# environmental clustering
eb <- envBlock(rasterLayer = awt,
speciesData = pa_data,
species = "Species",
k = 5)
foldExplorer(eb, awt, pa_data)
}
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab