Skip to content
Prev 1146 / 7420 Next

Species CoOccurance

Lanna,

I don't know exactly what do you mean by co-occurrence data frame, but
if you'd like to get a species-by-species matrix, in which you count
the co-occurrences of the species (columns in the sites-by-species
community matrix) with each other, you can use the crossprod function
or the %*% operator for a presence/absence matrix:

m <- matrix(rbinom(15,1,0.6),5,3)
t(m) %*% m
crossprod(m, m)

HTH,

Peter
On Fri, Mar 12, 2010 at 7:22 AM, Lanna Jin <lannajin at gmail.com> wrote: