[R-sig-eco] Species CoOccurance

Peter Solymos solymos at ualberta.ca
Fri Mar 12 16:01:27 CET 2010


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:
> Hello All,
>
> I've been sifting through tons of R Documentation, trying to find a command
> that converts a community matrix dataset into a species pair co-occurance
> data frame, and have failed miserably to find one.  Does a function already
> exist in one of the community analysis packages?
>
> Thanks in advance for your response!
>
> --
> Lanna Jin
>
> lannajin at gmail.com
> 510-898-8525
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>
>



More information about the R-sig-ecology mailing list