[R] Extract correlations from a matrix

Rolf Turner r.turner at auckland.ac.nz
Thu Nov 8 22:56:25 CET 2007


On 9/11/2007, at 9:01 AM, Julian Burgos wrote:

> 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
>

	Perhaps he wants

		which(w>0.6,arr.ind=TRUE)

	It is indeed hard to answer questions which require telepathy on the
	part of the responder.

		cheers,

			Rolf Turner

> 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)
>>
>>
>>
>>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting- 
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

######################################################################
Attention: 
This e-mail message is privileged and confidential. If you are not the 
intended recipient please delete the message and notify the sender. 
Any views or opinions presented are solely those of the author.

This e-mail has been scanned and cleared by MailMarshal 
www.marshalsoftware.com
######################################################################



More information about the R-help mailing list