R/nestedn0.R

"nestedn0" <-
function(comm)
{
    comm <- ifelse(comm > 0, 1, 0)
    R <- rowSums(comm)
    spmin <- apply(comm, 2, function(x) min((x*R)[x > 0]))
    n0 <- spmin
    for (i in 1:ncol(comm))
        n0[i] <- sum(comm[,i] == 0 & R > spmin[i])
    out <- list(spmin = spmin, n0 = n0, statistic = sum(n0))
    names(out$statistic) <- "N0"
    class(out) <- "nestedn0"
    out
}

Try the vegan package in your browser

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

vegan documentation built on Sept. 11, 2024, 7:57 p.m.