R/rndcomm.R

Defines functions rndcomm

Documented in rndcomm

rndcomm <- function(comm,replace=FALSE,species=FALSE,plots=FALSE)
{
    if (species) {
        out <- apply(comm,2,sample,replace=replace)
    }
    if (plots) {
        out <- apply(comm,1,sample,replace=replace)
    }
    if (!species & !plots) {
        tmp <- as.vector(as.matrix(comm))
        out <- as.data.frame(matrix(sample(tmp,replace=replace),ncol=ncol(comm)))
    }
    as.data.frame(out)
}

Try the labdsv package in your browser

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

labdsv documentation built on April 10, 2023, 5:08 p.m.