# NOT RUN {
# 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
# }
# NOT RUN {
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)
# }
# NOT RUN {
# 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
# }
# NOT RUN {
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)
# }
Run the code above in your browser using DataLab