1 | exclude.pairs(Cor.mat, M, th = 0.1, excluded = NULL)
|
Cor.mat |
|
M |
|
th |
|
excluded |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (Cor.mat, M, th = 0.1, excluded = NULL)
{
flag <- FALSE
cor.tmp <- abs(Cor.mat)
diag(cor.tmp) <- diag(cor.tmp) - diag(Cor.mat)
if (!is.null(excluded))
cor.tmp[excluded, ] <- 0
mm <- max(cor.tmp)
idxtorm <- which(cor.tmp == mm, arr.ind = TRUE)
if (mm > th) {
for (i in 1:dim(idxtorm)[1]) {
M[idxtorm[i, 1], idxtorm[i, 2]] <- M[idxtorm[i, 1],
idxtorm[i, 2]] - 1
}
dd <- diag(M)[unique(c(idxtorm))]
diag(M)[unique(c(idxtorm))] <- dd - 1
excluded <- rbind(excluded, idxtorm)
}
else {
excluded <- excluded
flag <- TRUE
}
return(list(M = M, excluded = excluded, flag = flag))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.