Overview

Core models

Selection of possible merges

# 1.
edge_nlm <- nlm_edgegradient(100, 100)
distance_nlm <- nlm_distancegradient(100, 100, origin = c(20, 20,10, 10))
random_nlm <- nlm_random(100, 100)

# 2.
gauss_nlm <- nlm_gaussianfield(100, 100)
rectan_nlm <- nlm_randomrectangularcluster(100, 100, maxl = 30, minl = 10)

# 3.
mosaic_nlm <- nlm_mosaicfield(100, 100)

# 4.
planar_nlm <- nlm_planargradient(100, 100)
tess_nlm <- nlm_mosaictess(100, 100, germs = 200)

# plot it
landscapetools::show_landscape(list("a" = landscapetools::util_merge(edge_nlm, list(distance_nlm, random_nlm)),
                                    "b" = landscapetools::util_merge(gauss_nlm, rectan_nlm),
                                    "c" = landscapetools::util_merge(mosaic_nlm, list(random_nlm)),
                                    "d" = landscapetools::util_merge(planar_nlm, list(distance_nlm, tess_nlm))))

Tips

If you are new to the raster package, I hope to collect here some useful tips how to handle raster data in general. Furthermore, this section also serves as a place to collect workflows on how to use NLMR and other R packages to simulate specific patterns one can find in the literature.

Basics

Counting cells

Ecologists are for example often interested in how much habitat one actually finds in the study area you are looking at and there are a couple of nice ways to do that with rasters. One of them is:

##      value  count
## [1,]     0 103336
## [2,]     1  44120

More specific tips

Simulate ecotones

Merging different types of NLMs, such as a planar gradient with a less autocorrelated landscape, provide a means of generating more complex landscapes and realistic-looking ecotones (Travis 2004):