data(forestgap)
rmat <- matrix(rnorm(100) > .1, ncol = 10)
display_matrix(label(rmat))
# With 8-way neighborhood mask and no wrapping around borders
nbmask8 <- matrix(c(1,1,1,
1,0,1,
1,1,1), ncol=3)
display_matrix(label(rmat, nbmask8, wrap = FALSE))
# On real data:
display_matrix(label(forestgap[[5]], nbmask8, wrap = FALSE))
Run the code above in your browser using DataLab