Converts a co-occurrence matrix (coma) to a co-occurrence vector (cove)

get_cove(x, ordered = TRUE, normalization = "none")

Arguments

x

A matrix - an output of the get_coma() function

ordered

The type of pairs considered. Either "ordered" (TRUE) or "unordered" (FALSE). The default is TRUE.

normalization

Should the output vector be normalized? Either "none" or "pdf". The "pdf" option normalizes a vector to sum to one. The default is "none".

Value

A co-occurrence vector

Examples

library(comat) data(raster_x, package = "comat") com = get_coma(raster_x) com
#> 1 2 3 #> 1 4 1 3 #> 2 1 2 2 #> 3 3 2 6
cov = get_cove(com) cov
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] #> [1,] 4 1 3 1 2 2 3 2 6
cov = get_cove(com, normalization = "pdf") cov
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] #> [1,] 0.1666667 0.04166667 0.125 0.04166667 0.08333333 0.08333333 0.125 #> [,8] [,9] #> [1,] 0.08333333 0.25