Learn R Programming

blockCV (version 2.1.1)

rangeExplorer: Explore spatial block size

Description

This function assists selection of block size. It allows the user to visualise the blocks interactively, viewing the impact of block size on number and arrangement of blocks in the landscape (and optionally on the distribution of species data in those blocks). Slide to the slected block size, and click Apply Changes to change the block size.

Usage

rangeExplorer(
  rasterLayer,
  speciesData = NULL,
  species = NULL,
  rangeTable = NULL,
  minRange = NULL,
  maxRange = NULL
)

Arguments

rasterLayer

A raster object as background map for visualisation.

speciesData

A simple features (sf) or SpatialPoints object containing species data (response variable). If provided, the species data will be shown on the map.

species

Character value indicating the name of the field in which the species data (response variable e.g. 0s and 1s) are stored. If provided, species presence and absence data will be shown in different colours.

rangeTable

A data.frame created by spatialAutoRange function containing spatial autocorrelation parameters of all covariates.

minRange

A numeric value to set the minimum possible range for creating spatial blocks. It is used to limit the searching domain of spatial block size.

maxRange

A numeric value to set the maximum possible range for creating spatial blocks. It is used to limit the searching domain of spatial block size.

Value

An interactive map with blocks (and optionally species data) superimposed. 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.

Details

The only required argument for this function is the rasterLayer. The rest are optional. If the rangeTable is provided, the minimum, maximum and initial ranges for searching the size of spatial blocks will be selected based on the spatial autocorrelation range of covariates. It is also possible to restrict the allowable range of block sizes by using the minRange and maxRanege arguments.

See Also

spatialBlock; spatialAutoRange for the rangeTable

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))

rangeExplorer(rasterLayer = awt) # the only mandatory input

# add species data to add them on the map
rangeExplorer(rasterLayer = awt,
              speciesData = pa_data,
              species = "Species",
              rangeTable = NULL,
              minRange = 30000, # limit the search domain
              maxRange = 100000)
}
# }

Run the code above in your browser using DataLab