search through a matrix
onyourmark wrote:
Hi. I have a 925 by 925 correlation matrix corM. I want to identify all variables that have correlation greater than 0.9. Can anyone suggest an "R way" of doing this? Thank you.
Example: # prepare example data: x <- matrix((1:25) / 25, 5, 5) rownames(x) <- letters[1:5] colnames(x) <- letters[1:5] # solution cbind(rownames(x)[row(x)[x > 0.9]], colnames(x)[col(x)[x > 0.9]]) Uwe Ligges