Create a matrix showing the connectivity between planning units. Connectivity is calculated as the average conductance of two planning units multiplied by the amount of shared boundary between the two planning units. Thus planning units that each have higher a conductance and share a greater boundary are associated with greater connectivity.
# S4 method for Spatial,character connectivity_matrix(x, y, ...) # S4 method for Spatial,Raster connectivity_matrix(x, y, ...) # S4 method for Raster,Raster connectivity_matrix(x, y, ...)
x 


y 

...  arguments passed to 
dsCMatrixclass
sparse symmetric matrix object.
This function returns a dsCMatrixclass
sparse symmetric matrix. Each row and column represents a planning unit.
Cell values represent the connectivity between two planning units. To
reduce computational burden for Rasterclass
data,
data are missing for cells with NA
values in the argument to
x
. Furthermore, all cells along the diagonal are missing values
since a planing unit does not share connectivity with itself.
# load data data(sim_pu_raster, sim_pu_polygons, sim_pu_lines, sim_pu_points, sim_features) # create connectivity matrix using raster planning unit data using # the raster cost values to represent conductance ## extract 9 planning units r < crop(sim_pu_raster, c(0, 0.3, 0, 0.3)) ## extract conductance data for the 9 planning units cd < crop(r, sim_features[[1]]) ## make connectivity matrix cm_raster < connectivity_matrix(r, cd) ## plot data and matrix par(mfrow = c(1,3)) plot(r, main = "planning units", axes = FALSE, box = FALSE) plot(cd, main = "conductivity", axes = FALSE, box = FALSE) plot(raster(as.matrix(cm_raster)), main = "connectivity", axes = FALSE, box = FALSE)# create connectivity matrix using polygon planning unit data using # the habitat suitability data for sim_features[[1]] to represent # planning unit conductances ## subset data to 9 polygons ply < sim_pu_polygons[c(1:2, 10:12, 20:22), ] ## make connectivity matrix cm_ply < connectivity_matrix(ply, sim_features[[1]]) ## plot data and matrix par(mfrow = c(1,3)) plot(ply, main = "planning units") plot(sim_features[[1]], main = "conductivity", axes = FALSE, box = FALSE) plot(raster(as.matrix(cm_ply)), main = "connectivity", axes = FALSE, box = FALSE)