comat v0.8.2

0

Monthly downloads

0th

Percentile

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>).

Readme

comat

Travis build
status Codecov test
coverage CRAN
status CRAN RStudio mirror
downloads

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

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.

Functions in comat

Name Description
get_cocove Create a co-located co-occurrence vector (cocove)
raster_x_na A matrix with categories and missing values
raster_x A matrix with categories
raster_w A matrix with weights
raster_w_na A matrix with weights and missing values
rcpp_xy_from_matrix Coordinates from a matrix
rcpp_cell_from_xy Get cell number
create_neighborhood Create neighborhood coordinates
get_wecoma Create a weighted co-occurrence matrix (wecoma)
get_incoma Create an integrated co-occurrence matrix (incoma)
get_cocoma Create a co-located co-occurrence matrix (cocoma)
get_coma Create a co-occurrence matrix (coma)
get_incove Create an integrated co-occurrence vector (incove)
get_cove Create a co-occurrence vector (cove)
comat-package comat: Creates Co-Occurrence Matrices of Spatial Data
get_wecove Create a weighted co-occurrence vector (wecove)
No Results!

Last month downloads

Details

License MIT + file LICENSE
Encoding UTF-8
LazyData false
RoxygenNote 7.0.2
LinkingTo Rcpp, RcppArmadillo
SystemRequirements C++11
URL https://nowosad.github.io/comat/
BugReports https://github.com/Nowosad/comat/issues
NeedsCompilation yes
Packaged 2020-03-17 14:04:29 UTC; jn
Repository CRAN
Date/Publication 2020-03-17 14:40:06 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/comat)](http://www.rdocumentation.org/packages/comat)