R/make.symmetric.R

Defines functions make.symmetric

Documented in make.symmetric

make.symmetric <-
function(x)
{
    if (dim(x)[1] != dim(x)[2])
        stop("'x' is not sqare matrix")
    rval <- t(x)
    m <- (x[lower.tri(x)] + rval[lower.tri(rval)]) / 2
    rval[lower.tri(rval)] <- m
    rval <- t(rval)
    rval[lower.tri(rval)] <- m
    rval
}

Try the dclone package in your browser

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

dclone documentation built on May 2, 2019, 6:08 p.m.