Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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

Examples

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)

}

blockCV

Spatial and Environmental Blocking for K-Fold Cross-Validation

v2.1.1
GPL-3
Authors
Roozbeh Valavi [aut, cre], Jane Elith [aut], José Lahoz-Monfort [aut], Gurutzeta Guillera-Arroita [aut]
Initial release
2020-02-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.