[R] Getting the row/column of matrix for some values?

Rajarshi Guha rxg218 at psu.edu
Thu Apr 14 04:33:25 CEST 2005

On Wed, 2005-04-13 at 21:09 -0500, Chris Bergstresser wrote:
> Hi all --
>     Quick (I hope) question: I've got a correlation matrix.  Is there a 
> quick way to find all the row/column names for those correlations higher 
> than some value, like 0.4?

> x <- matrix(runif(50), nrow=10)
> which(cor(x) > .4, arr.ind=TRUE)

Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
Q: What do you get when you cross a Post Modernist with a Mafioso?
A: An offer you can't understand.

More information about the R-help mailing list