R/as.fisher.R

"as.fisher" <-
    function (x, ...) 
{
    if (inherits(x, "fisher")) 
        return(x)
    if (!identical(all.equal(x, round(x)), TRUE))
        stop("function accepts only integers (counts)")
    freq <- x[x > 0]
    freq <- table(freq, deparse.level = 0)
    nm <- names(freq)
    freq <- as.vector(freq)
    names(freq) <- nm
    class(freq) <- "fisher"
    freq
}

Try the vegan package in your browser

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

vegan documentation built on May 2, 2019, 5:51 p.m.