Skip to content

Pairwise correlation

1 message · R. Michael Weylandt

#
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: