if (FALSE) {
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)
# OR
plot(sim.popn(D = randomDensity, core = tempmask, model2D = "IHP",
details = list(D = 10, p = 0.4, A = 0.4, plt = TRUE)),
add = TRUE, frame = FALSE)
## plot intermediate steps A, C, D
opar <- par(mfrow = c(1,3))
mrcmask <- randomHabitat(tempmask, p = 0.4, A = 0.4, plt = TRUE)
par(opar)
## 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