Converts an integrated co-occurrence matrix (incoma) to an integrated co-occurrence vector (incove)

get_incove(x, ordered = TRUE, repeated = TRUE, normalization = "none")

Arguments

x

A matrix - an output of the get_incoma() function

ordered

The type of pairs considered. Either "ordered" (TRUE) or "unordered" (FALSE). The default is TRUE. See details for more explanation.

repeated

Should the repeated co-located co-occurrence matrices be used? Either "repeated" (TRUE) or "unrepeated" (FALSE). The default is TRUE. See details for more explanation.

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

An integrated co-occurrence vector

Details

All values are kept when ordered = TRUE and repeated = TRUE. When ordered = TRUE and repeated = FALSE all values from cocoma (but only one cocoma for each pair) and all coma values are kept. ordered = FALSE and repeated = TRUE keeps all values from cocoma, but divides coma values by 2. ordered = FALSE and repeated = FALSE keeps all values from cocoma (but only one cocoma for each pair), and divides coma values by 2.

Examples

library(comat) data(raster_x, package = "comat") data(raster_w, package = "comat") x = list(raster_x, raster_w, raster_x) incom = get_incoma(x) incom
#> 1 2 3 2 4 6 8 9 1 2 3 #> 1 4 1 3 3 3 1 0 1 4 1 3 #> 2 1 2 2 0 2 1 1 1 1 2 2 #> 3 3 2 6 2 1 1 2 5 3 2 6 #> 2 3 0 2 2 1 1 0 1 3 0 2 #> 4 3 2 1 1 0 2 2 1 3 2 1 #> 6 1 1 1 1 2 0 0 0 1 1 1 #> 8 0 1 2 0 2 0 0 1 0 1 2 #> 9 1 1 5 1 1 0 1 4 1 1 5 #> 1 4 1 3 3 3 1 0 1 4 1 3 #> 2 1 2 2 0 2 1 1 1 1 2 2 #> 3 3 2 6 2 1 1 2 5 3 2 6 #> attr(,"no_unique") #> [1] 3 5 3
incov1 = get_incove(incom) incov1
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] #> [1,] 4 1 3 1 2 2 3 2 6 3 0 2 3 2 #> [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] #> [1,] 1 1 1 1 0 1 2 1 1 5 4 1 #> [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] #> [1,] 3 1 2 2 3 2 6 3 3 1 0 1 #> [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] #> [1,] 0 2 1 1 1 2 1 1 2 5 2 1 #> [,51] [,52] [,53] [,54] [,55] [,56] [,57] [,58] [,59] [,60] [,61] [,62] #> [1,] 1 0 1 1 0 2 2 1 1 2 0 0 #> [,63] [,64] [,65] [,66] [,67] [,68] [,69] [,70] [,71] [,72] [,73] [,74] #> [1,] 0 0 2 0 0 1 1 1 0 1 4 3 #> [,75] [,76] [,77] [,78] [,79] [,80] [,81] [,82] [,83] [,84] [,85] [,86] #> [1,] 3 1 0 1 0 2 1 1 1 2 1 1 #> [,87] [,88] [,89] [,90] [,91] [,92] [,93] [,94] [,95] [,96] [,97] [,98] #> [1,] 2 5 4 1 3 1 2 2 3 2 6 3 #> [,99] [,100] [,101] [,102] [,103] [,104] [,105] [,106] [,107] [,108] #> [1,] 0 2 3 2 1 1 1 1 0 1 #> [,109] [,110] [,111] [,112] [,113] [,114] [,115] [,116] [,117] [,118] #> [1,] 2 1 1 5 4 1 3 1 2 2 #> [,119] [,120] [,121] #> [1,] 3 2 6
incov2 = get_incove(incom, ordered = FALSE) incov2
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] #> [1,] 2 1 1 3 2 3 3 0 2 3 2 1 1 1 #> [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] #> [1,] 1 0 1 2 1 1 5 4 1 3 1 2 #> [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] #> [1,] 2 3 2 6 3 3 1 0 1 0 2 1 #> [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] #> [1,] 1 1 2 1 1 2 5 1 1 0 1 2 #> [,51] [,52] [,53] [,54] [,55] [,56] [,57] [,58] [,59] [,60] [,61] [,62] #> [1,] 0 0 2 0 0 1 1 0 1 2 3 3 #> [,63] [,64] [,65] [,66] [,67] [,68] [,69] [,70] [,71] [,72] [,73] [,74] #> [1,] 1 0 1 0 2 1 1 1 2 1 1 2 #> [,75] [,76] [,77] [,78] [,79] [,80] [,81] [,82] [,83] [,84] [,85] [,86] #> [1,] 5 4 1 3 1 2 2 3 2 6 3 0 #> [,87] [,88] [,89] [,90] [,91] [,92] [,93] [,94] [,95] [,96] [,97] [,98] #> [1,] 2 3 2 1 1 1 1 0 1 2 1 1 #> [,99] [,100] [,101] [,102] [,103] [,104] [,105] #> [1,] 5 2 1 1 3 2 3
incov3 = get_incove(incom, ordered = FALSE, normalization = "pdf") incov3
#> [,1] [,2] [,3] [,4] [,5] [,6] #> [1,] 0.01851852 0.009259259 0.009259259 0.02777778 0.01851852 0.02777778 #> [,7] [,8] [,9] [,10] [,11] [,12] [,13] #> [1,] 0.01388889 0 0.009259259 0.01388889 0.009259259 0.00462963 0.00462963 #> [,14] [,15] [,16] [,17] [,18] [,19] [,20] #> [1,] 0.00462963 0.00462963 0 0.00462963 0.009259259 0.00462963 0.00462963 #> [,21] [,22] [,23] [,24] [,25] [,26] #> [1,] 0.02314815 0.01851852 0.00462963 0.01388889 0.00462963 0.009259259 #> [,27] [,28] [,29] [,30] [,31] [,32] #> [1,] 0.009259259 0.01388889 0.009259259 0.02777778 0.01388889 0.01388889 #> [,33] [,34] [,35] [,36] [,37] [,38] [,39] #> [1,] 0.00462963 0 0.00462963 0 0.009259259 0.00462963 0.00462963 #> [,40] [,41] [,42] [,43] [,44] [,45] #> [1,] 0.00462963 0.009259259 0.00462963 0.00462963 0.009259259 0.02314815 #> [,46] [,47] [,48] [,49] [,50] [,51] [,52] #> [1,] 0.009259259 0.009259259 0 0.009259259 0.01851852 0 0 #> [,53] [,54] [,55] [,56] [,57] [,58] [,59] #> [1,] 0.01851852 0 0 0.009259259 0.009259259 0 0.009259259 #> [,60] [,61] [,62] [,63] [,64] [,65] [,66] #> [1,] 0.01851852 0.01388889 0.01388889 0.00462963 0 0.00462963 0 #> [,67] [,68] [,69] [,70] [,71] [,72] #> [1,] 0.009259259 0.00462963 0.00462963 0.00462963 0.009259259 0.00462963 #> [,73] [,74] [,75] [,76] [,77] [,78] #> [1,] 0.00462963 0.009259259 0.02314815 0.01851852 0.00462963 0.01388889 #> [,79] [,80] [,81] [,82] [,83] [,84] #> [1,] 0.00462963 0.009259259 0.009259259 0.01388889 0.009259259 0.02777778 #> [,85] [,86] [,87] [,88] [,89] [,90] [,91] #> [1,] 0.01388889 0 0.009259259 0.01388889 0.009259259 0.00462963 0.00462963 #> [,92] [,93] [,94] [,95] [,96] [,97] [,98] #> [1,] 0.00462963 0.00462963 0 0.00462963 0.009259259 0.00462963 0.00462963 #> [,99] [,100] [,101] [,102] [,103] [,104] #> [1,] 0.02314815 0.01851852 0.009259259 0.009259259 0.02777778 0.01851852 #> [,105] #> [1,] 0.02777778