View source: R/cv_block_size.R
cv_block_size | R Documentation |
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 selected block size, and click Apply Changes to change the block size.
cv_block_size(r, x = NULL, column = NULL, min_size = NULL, max_size = NULL)
r |
a terra SpatRaster object (optional). If provided, its extent will be used to specify the blocks. It also supports stars, raster, or path to a raster file on disk. |
x |
a simple features (sf) or SpatialPoints object of spatial sample data. If |
column |
character (optional). Indicating the name of the column in which response variable (e.g. species data as a binary response i.e. 0s and 1s) is stored to be shown on the plot. |
min_size |
numeric; the minimum size of the blocks (in metres) to explore. |
max_size |
numeric; the maximum size of the blocks (in metres) to explore. |
an interactive shiny session
if(interactive()){
library(blockCV)
# import presence-absence species data
points <- read.csv(system.file("extdata/", "species.csv", package = "blockCV"))
pa_data <- sf::st_as_sf(points, coords = c("x", "y"), crs = 7845)
# manually choose the size of spatial blocks
cv_block_size(x = pa_data,
column = "occ",
min_size = 2e5,
max_size = 9e5)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.