R/full.R

Defines functions full

Documented in full

full <- function(v)
{
# converts a lower-triangular distance vector to a symmetric matrix
    n <- (1 + sqrt(1 + 8 * length(v)))/2
        if(abs(n - round(n)) > 0.0000001)
        stop("Matrix not square.")
    n <- round(n)
        full <- matrix(0, n, n)
        full[lower.tri(full)] <- v
    full2 <- t(full)
    diag(full2) <- 0
        full + full2
}

Try the ecodist package in your browser

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

ecodist documentation built on Nov. 2, 2023, 6:01 p.m.