Learn how to use the {NLMR} R package to simulate neutral landscape models (NLMs), a common set of various null models for spatial analysis and as input for spatially-explicit, generic models.
The {NLMR}
R package to simulate neutral landscape models (NLM). Designed to be a generic framework like NLMpy, it leverages the ability to simulate the most common NLM that are described in the ecological literature.
If you want to learn more about the {NLMR}
package and the accompanying {landscapetools}
package, check the publication Sciaini, Fritsch, Scherer 6 Simpkins (2019) Methods in Ecology and Evolution.
Install the release version from CRAN:
install.packages("NLMR")
or the development version from Github, along with two packages that are needed for the generation of random fields:
install.packages("remotes")
remotes::install_github("cran/RandomFieldsUtils")
remotes::install_github("cran/RandomFields")
remotes::install_github("ropensci/NLMR")
Each neutral landscape models is simulated with a single function (all starting with nlm_
) in NLMR, e.g.:
{NLMR}
supplies 15 NLM algorithms, with several options to simulate derivatives of them. The algorithms differ from each other in spatial auto-correlation, from no auto-correlation (random NLM) to a constant gradient (planar gradients).
The package builds on the advantages of the raster package and returns all simulation as RasterLayer
objects, thus ensuring a direct compatibility to common GIS tasks and a flexible and simple usage:
class(random_cluster)
[1] "RasterLayer"
attr(,"package")
[1] "raster"
random_cluster
class : RasterLayer
dimensions : 100, 100, 10000 (nrow, ncol, ncell)
resolution : 1, 1 (x, y)
extent : 0, 100, 0, 100 (xmin, xmax, ymin, ymax)
crs : NA
source : memory
names : clumps
values : 1, 3 (min, max)
The {landscapetools}
package provides a function show_landscape
that was developed to plot raster objects and help users to adhere to some standards concerning color scales and typography. This means for example that by default the viridis color scale is applied (and you can pick others from the {viridis}
package, too).
#install.packages("landscapetools")
## plotting continuous values
landscapetools::show_landscape(random_cluster)
## plotting discrete values
landscapetools::show_landscape(random_curdling, discrete = TRUE)
## using another viridis palette
landscapetools::show_landscape(midpoint_displacement, viridis_scale = "magma")
For attribution, please cite this work as
Scherer (2021, Aug. 6). Ecological Dynamics: Simulate Neutral Landscape Models. Retrieved from https://ecodynizw.github.io/posts/nlmr/
BibTeX citation
@misc{scherer2021simulate, author = {Scherer, Cedric}, title = {Ecological Dynamics: Simulate Neutral Landscape Models}, url = {https://ecodynizw.github.io/posts/nlmr/}, year = {2021} }