[R] Extract correlations from a matrix

Julian Burgos jmburgos at u.washington.edu
Thu Nov 8 21:01:25 CET 2007


Hey Christoph,

It is not clear what do you want to "extract".
w[w>0.6] does give you the correlation values above 0.6.  What is your 
question?

Julian

Christoph Scherber wrote:
> Dear R users,
> 
> suppose I have a matrix of observations for which I calculate all 
> pair-wise correlations:
> 
> m=matrix(sample(1:100,replace=T),10,10)
> w=cor(m,use="pairwise.complete.obs")
> 
> How do I extract only those correlations that are >0.6?
> 
> w[w>0.6] #obviously doesn´t work,
> 
> and I can´t find a way around it.
> 
> I would very much appreciate any help!
> 
> Best wishes
> Christoph
> 
> 
> (using R 2.5.1 on Windows XP)
> 
> 
> 
>



More information about the R-help mailing list