Skip to content
Prev 277786 / 398506 Next

Pairwise correlation

Here's a function Josh Wiley provided in another thread:

spec.cor <- function(dat, r, ...) {
    x <- cor(dat, ...)
    x[upper.tri(x, TRUE)] <- NA
    i <- which(abs(x) >= r, arr.ind = TRUE)
    data.frame(matrix(colnames(x)[as.vector(i)], ncol = 2), value = x[i])
}

Michael
On Thu, Nov 17, 2011 at 4:08 PM, Musa Hassan <musahass at gmail.com> wrote:
Message-ID: <CAAmySGPisTgSS+g99VQTCSS3fG1487FtJc-3OC9s=g-6N6UsRA@mail.gmail.com>
In-Reply-To: <CAK-U2_xhrtcP6N-5FxU2oALchKF-wciZxL2KJx+CJqKZmpfCPQ@mail.gmail.com>