orderdClu {nem} | R Documentation |
This function reorder the groups in an image matrix in such a way that the blocks with a higher average weigh are placed on the left hand side of the matrix.
orderdClu(res)
res |
The object produced by the function |
tclu |
The vector indication to which group a certain unit belongs. |
IMg |
Reordered image matrix. |
Marjan Cugmas, Aleš Žiberna
orderdClu <- function(res){ means<-fun.by.blocks(res, ignore.diag=TRUE) crit<-colSums(means)+rowSums(means) r <- order(crit, decreasing = TRUE) a <- IM(res)[1,,] a <- a[as.vector(r), as.vector(r)] IMg <- array(NA, dim = c(1, max(r), max(r))) (IMg[1,,] <- a) r<-rank(-crit) names(r) <- 1:max(clu(res)) tclu <- r[as.character(clu(res))] return(list(tclu, IMg)) }