marxan_boundary_data_to_matrix {prioritizr} | R Documentation |
Convert a data.frame
object containing Marxan boundary data
to matrix format. This function is designed specifically for
boundary data (not connectivity data).
It ensures that the output matrix correctly specifies
symmetric spatial relationships between planning units.
marxan_boundary_data_to_matrix(x, data)
x |
|
data |
|
A dgCMatrix
sparse matrix object.
In earlier versions, the function could convert boundary data that pertain to multiple zones. This is no longer possible, following updates to streamline the package.
# create marxan boundary with four planning units and one zone
bldf1 <- expand.grid(id1 = seq_len(4), id2 = seq_len(4))
bldf1$boundary <- 1
bldf1$boundary[bldf1$id1 == bldf1$id2] <- 0.5
# convert to matrix
m1 <- marxan_boundary_data_to_matrix(NULL, bldf1)
# visualize matrix
## Not run:
image(m1)
## End(Not run)