Learn R Programming

tabula (version 1.0.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 which pairs of taxa occur together in at least one sample

See Also

matrix

Other logical matrix: IncidenceMatrix-class

Examples

Run this code
# NOT RUN {
# Create an incidence (presence/absence) matrix
# Data will be coerced with as.logical()
C1 <- IncidenceMatrix(data = sample(0:1, 100, TRUE),
                      nrow = 10, ncol = 10)

# Coerce to a co-occurrence matrix
D <- as(C1, "OccurrenceMatrix")

# Create a count data matrix
A <- CountMatrix(data = sample(0:10, 100, TRUE),
                 nrow = 10, ncol = 10, byrow = TRUE)

# Coerce to presence/absence
C2 <- as(A, "IncidenceMatrix")
# }

Run the code above in your browser using DataLab