The motif package implements and extends ideas of the pattern-based spatial analysis in R. It describes spatial patterns of categorical raster data for any defined regular and irregular areas. Patterns are represented quantitatively using built-in signatures based on co-occurrence matrices but also allows for any user-defined functions. It enables spatial analysis such as search, change detection, and clustering to be performed on spatial patterns.


You can install the released version of motif from CRAN with:

And the development version from GitHub with:

# install.packages("remotes")


Contributions to this package are welcome. The preferred method of contribution is through a GitHub pull request. Feel free to contact us by creating an issue.


To cite the motif package in publications, please use this paper:

Nowosad, J. Motif: an open-source R tool for pattern-based spatial analysis. Landscape Ecol (2021).

LaTeX/BibTeX version can be obtained with: