R/chao2.R

Defines functions `chao2`

`chao2` <-
function(x,taxa.row=TRUE) {
  if (taxa.row==FALSE) x<-t(x)
  if (ncol(as.matrix(x))==1) ch<-(int.chao(x))
  else if (nrow(as.matrix(x))==1) ch<-(int.chao(x))
    else {mat.vectorized <- numeric(length(x[,1]))
     for (i in 1:length(x[,1])) mat.vectorized[i] <- length(x[i,][x[i,]>0])
     ch<-int.chao(mat.vectorized)
       }
  return(ch)
}

Try the fossil package in your browser

Any scripts or data that you put into this service are public.

fossil documentation built on March 23, 2020, 5:06 p.m.