Learn R Programming

tabula (version 1.2.0)

OccurrenceMatrix-class: Co-occurrence matrix

Description

An S4 class to represent a co-occurrence matrix.

Arguments

Details

A co-occurrence matrix is a symetric matrix with zeros on its main diagonal, which works out how many times (expressed in percent) each pairs of taxa occur together in at least one sample.

See Also

matrix

Other abundance matrix: CountMatrix-class, FrequencyMatrix-class

Examples

Run this code
# NOT RUN {
# Create a count data matrix
A1 <- CountMatrix(data = sample(0:10, 100, TRUE),
                  nrow = 10, ncol = 10, byrow = TRUE)

# Coerce counts to frequencies
B <- as(A1, "FrequencyMatrix")

# Row sums are internally stored before coercing to a frequency matrix
totals(B) # Get row sums

# This allows to restore the source data
A2 <- as(B, "CountMatrix")
all(A1 == A2)

# Coerce to a co-occurrence matrix
C <- as(B, "OccurrenceMatrix")
# }

Run the code above in your browser using DataLab