Learn R Programming

blockCV (version 2.1.1)

foldExplorer: Explore the generated folds

Description

A function for visualising the generated folds on a map, and allowing interactive exploration of the data in the folds, using the RStudio Shiny app.

Usage

foldExplorer(blocks, rasterLayer, speciesData)

Arguments

blocks

An SpatialBlock, EnvironmentalBlock or BufferedBlock object.

rasterLayer

A raster object as background map for visualisation.

speciesData

A simple features (sf) or SpatialPoints object containing species data (response variable).

Value

An interactive map showing folds and the species data, that can be used to explore folds. Note that this can also be opened in a web browser window. When you return to the R console, press "Esc" to return to the prompt.

See Also

spatialBlock, buffering and envBlock

Examples

Run this code
# 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