bam_clusters {bamm} | R Documentation |
Function to estimate the connectivity of suitable areas given an adjacency matrix.
bam_clusters(model, ngbs = 1, plot_model = FALSE)
model |
A niche model in raster format or a |
ngbs |
Numeric. Number of neighbors (see details). |
plot_model |
Logical. Indicates whether to plot the niche model using a leaflet map, connected suitable cells shown in the same color. |
The main result of the function is the Connectivity-Suitability-Diagram (CSD). In this diagram connected suitable cells make clusters of pixels. For more details about the CSD see (Soberon and Osorio-Olvera, 2022).
An object of class csd
. It contains three slots.
1) connections: a data.frame with three columns where first and the second
represent (x and y) centroid coordinates of the niche model
and the third column with the cluster ID where they belong.
2) interactive_map: a leaflet map of connected suitable pixels shown in
the same color. 3) A RasterLayer of connected suitable pixels.
Luis Osorio-Olvera & Jorge SoberĂ³n
SoberĂ³n J, Osorio-Olvera L (2022). “A Dynamic Theory of the Area of Distribution.” doi:10.48550/ARXIV.2212.06308, https://arxiv.org/abs/2212.06308..
set.seed(891)
model_path <- system.file("extdata/Lepus_californicus_cont.tif",
package = "bamm")
model <- raster::raster(model_path)
model <- model > 0.7
clusterin <- bamm::bam_clusters(model,ngbs=1,plot_model=TRUE)
raster::plot(clusterin@raster_map)
clusterin@interactive_map