## Not run: ------------------------------------
#
# tempmask <- make.mask(nx = 100, ny = 100, spacing = 20)
# mrcmask <- randomHabitat(tempmask, p = 0.4, A = 0.4)
# plot(mrcmask, dots = FALSE, col = "green")
# pop <- sim.popn(10, mrcmask, model2D = "IHP")
# plot(pop, add = TRUE)
#
# ## plot intermediate steps A, C, D
# par(mfrow = c(1,3))
# mrcmask <- randomHabitat(tempmask, p = 0.4, A = 0.4, plt = TRUE)
# par(mfrow = c(1,1)) ## reset to default
#
# ## keep non-habitat cells
# mrcmask <- randomHabitat(tempmask, p = 0.4, A = 0.4, drop = FALSE)
# plot(mrcmask, covariate = "habitat", dots = FALSE,
# col = c("grey","green"), breaks = 2)
#
# ## effect of purging small patches
# opar <- par(mfrow=c(1,2))
# mrcmask <- randomHabitat(tempmask, p = 0.4, A = 0.4, minpatch = 1)
# plot(mrcmask, dots = FALSE, col ="green")
# mrcmask <- randomHabitat(tempmask, p = 0.4, A = 0.4, minpatch = 5)
# plot(mrcmask, dots = FALSE, col ="green")
# par(opar)
## ---------------------------------------------
Run the code above in your browser using DataLab