Thanks Michael, 

I just started on the following code (below), and realized I should as as
this might exist. 

basically what I'd like is for the function to return (basically) what you
just suggested, plus the names of the two variables (I suppose pasted
together would be good). 

I hope that is clear.

# 
sig.cor <- function(dat, r, ...){

cv2 <- data.frame(cor(dat))
var.names <- rownames(cv2)

list.cv2 <- which(cv2 >=r | cv2 <= -r, arr.ind=T)
cor.r <- cv2[list.cv2[which(list.cv2 [,"row"]!=list.cv2 [,"col"]),]]
cor.names <- var.names[list.cv2[which(list.cv2 [,"row"]!=list.cv2
[,"col"]),]]

        
return(cor.r)

}





Michael Weylandt wrote:
> 
> What exactly do you mean "returns" them? More generally I suppose,
> what do you have in mind to do with this?
> 
> You could do something like this:
> 
> BigCorrelation <- function(X){
> 
>      return(which(abs(cor(X)) > 0.9, arr.ind = T))
> }
> 
> but it hardly seems worth its own function call.
> 
> On Thu, Nov 17, 2011 at 12:42 AM, B77S &lt;bps0002@&gt; wrote:
>> Hello,
>>
>>  I would like to find out if a function already exists that returns only
>> pairwise correlations above/below a certain threshold (e.g, -.90, .90)
>>
>> Thank you.
>>
>>
>>
>> --
>> View this message in context:
>> http://r.789695.n4.nabble.com/return-only-pairwise-correlations-greater-than-given-value-tp4079028p4079028.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help@ 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.
>>
> 
> ______________________________________________
> R-help@ 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.
> 


--
View this message in context: 
http://r.789695.n4.nabble.com/return-only-pairwise-correlations-greater-than-given-value-tp4079028p4079044.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@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.

Reply via email to