MyNixOS website logo
Description

Creates Co-Occurrence Matrices of Spatial Data.

Builds co-occurrence matrices based on spatial raster data. It includes creation of weighted co-occurrence matrices (wecoma) and integrated co-occurrence matrices (incoma; Vadivel et al. (2007) <doi:10.1016/j.patrec.2007.01.004>).

comat

Codecov testcoverage CRANstatus CRAN RStudio mirrordownloads

The goal of comat is to create co-occurrence matrices based on spatial data, including a weighted co-occurrence matrix (wecoma) and an integrated co-occurrence matrix (incoma).

Installation

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

install.packages("comat")

You can install the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("Nowosad/comat")

Example

This is a basic example which shows you how to create a weighted co-occurrence matrix (wecoma) based on two simple rasters (for simplicity presented as matrices). The first one raster_x represents some categories, and the second one raster_w represents weights.

library(comat)
library(raster)
#> Loading required package: sp
data(raster_x, package = "comat")
data(raster_w, package = "comat")
raster_x
#>      [,1] [,2] [,3]
#> [1,]    1    1    3
#> [2,]    1    3    3
#> [3,]    2    2    3
raster_w
#>      [,1] [,2] [,3]
#> [1,]    2    2    9
#> [2,]    6    4    9
#> [3,]    4    8    9

The get_wecoma() function can be next used to create a weighted co-occurrence matrix.

get_wecoma(
  raster_x,
  raster_w,
  neighbourhood = 4
)
#>      1    2    3
#> 1 12.0  5.0 13.5
#> 2  5.0 12.0 14.5
#> 3 13.5 14.5 49.0

This function allows for some parametrization using additional arguments, e.g.:

get_wecoma(
  raster_x,
  raster_w,
  neighbourhood = 4,
  fun = "focal",
  na_action = "keep"
)
#>    1  2  3
#> 1 12  6 10
#> 2  4 12 16
#> 3 17 13 49

Documentation

For more examples see the package’s vignettes:

  1. A co-occurrence matrix (coma) representation
  2. A weighted co-occurrence matrix (wecoma) representation
  3. An integrated co-occurrence matrix (incoma) representation

Contribution

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

Citation

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

Nowosad J, Stepinski TF (2021) Pattern-based identification and mapping of landscape types using multi-thematic data, International Journal of Geographical Information Science, DOI: 10.1080/13658816.2021.1893324

LaTeX/BibTeX version can be obtained with:

library(comat)
citation("comat")
Metadata

Version

0.9.5

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows