R/MK_BCentrality.R
MK_BCentrality.Rd
Use this function to calculate the BC, BCIIC and BCPC indexes under one or several distance thresholds.
MK_BCentrality( nodes, id, attribute = NULL, area_unit = "ha", distance = list(type = "centroid", resistance = NULL), metric = c("BC", "BCIIC", "BCPC"), distance_thresholds = NULL, probability = NULL, LA = NULL, coneforpath = NULL, dA = FALSE, dvars = FALSE, parallel = FALSE, rasterparallel = FALSE, write = NULL )
nodes | Object of class sf, SpatialPolygonsDataFrame or raster. The shapefile must be in a projected coordinate system. |
---|---|
id | character. If nodes is a shapefile then you can specify the column name with the node ID. If NULL, then a new id will be generated. |
attribute | character or vector. If nodes is a shappefile then you must specify the column name with the attribute in the data table selected for the nodes. If nodes is a raster layer then it must be a numeric vector with the node's attribute. The length of the vector must be equal to the number of nodes. The numeric vector is multiplied by the area of each node to obtain a weighted habitat index. If NULL the node area will be used as a node attribute, the unit area can be selected using the "area_unit" argument. |
area_unit | character. If attribute is NULL you can set an area unit, ?unit_covert compatible unit ("m2", "Dam2, "km2", "ha", "inch2", "foot2", "yard2", "mile2"). Default equal to "m2". |
distance | list. Distance parameters. For example: type, resistance,or keep. For "type" choose one of the distances: "centroid" (faster), "edge", "hausdorff-edge", "least-cost" or "commute-time". If the type is equal to "least-cost" or "commute-time", then you have to use the "resistance" argument. To see more arguments see the ?distancefile. |
metric | character. Choose a Betweenness Centrality Metric: "BC" or "BCIIC" considering topologycal distances or "BCPC" considering maximum product probabilities. |
distance_thresholds | numeric. Distance or distances thresholds (meters) to establish connections. For example, one distance: distance_threshold = 30000; two or more specific distances: distance_thresholds = c(30000, 50000); sequence distances: distance_thresholds = seq(10000,100000, 10000). |
probability | numeric. Connection probability to the selected distance threshold, e.g., 0.5 that is 50 percentage of probability connection. Use in case of selecting the "BPC" metric. |
LA | numeric. Maximum landscape attribute (attribute unit, if attribute is NULL then unit is equal to ha). |
coneforpath | character. Path to Conefor 2.6 with command line interface (http://www.conefor.org/coneforsensinode.html). Example, "C:/Users/coneforWin64.exe". |
dA | logical. If TRUE, then the delta attribute will be added to the node's importance result. |
dvars | logical. If TRUE, then the absolute variation will be added to the node's importance result. |
parallel | numeric. Specify the number of cores to use for parallel processing, default = NULL. Parallelize the function using furrr package and multiprocess plan. |
rasterparallel | logical. If parallel is FALSE and nodes is a raster then you can use this argument to assign the metrics values to the nodes raster. It is useful when raster resolution is less than 100 m2. |
write | character. Write output shapefile, example, "C:/ejemplo.shp". |
Saura, S. and Torne, J. (2012). Conefor 2.6. Universidad Politecnica de Madrid. Available at www.conefor.org.
Freeman L.C. (1977). Set of Measures of Centrality Based on Betweenness. Sociometry 40: 35-41.
Bodin, O. and Saura, S. (2010). Ranking individual habitat patches as connectivity providers: integrating network analysis and patch removal experiments. Ecological Modelling 221: 2393-2405.
if (FALSE) { library(Makurhini) data("vegetation_patches", package = "Makurhini") nrow(vegetation_patches) #Number of patches #Two distance thresholds BCIIC <- MK_BCentrality(nodes = vegetation_patches, id = "id", coneforpath = "C:/Users/coneforWin64.exe", distance = list(type = "centroid"), metric = "BCIIC", LA = NULL, distance_thresholds = c(10000, 30000)) #10 and 30 km #Using raster data("raster_vegetation_patches", package = "Makurhini") BCPC <- MK_BCentrality(nodes = raster_vegetation_patches, coneforpath = "C:/Users/coneforWin64.exe", attribute = NULL, distance = list(type = "centroid"), metric = "BCPC", probability = 0.5, LA = NULL, distance_thresholds = 40000) #40 km BCPC_parallel <- MK_BCentrality(nodes = raster_vegetation_patches, coneforpath = "C:/Users/coneforWin64.exe", id = "id", attribute = NULL, distance = list(type = "centroid"), metric = "BCPC", LA = NULL, probability = 0.5, distance_thresholds = c(40000, 60000), parallel = 4) #40 and 60 km }