[R] compute pearson correlation p-values for all combinations of columns of 2 matrices

David Winsemius dwinsemius at comcast.net
Tue Nov 25 15:50:33 CET 2008


Didn't this question get asked and answered within a week or two?

Daren Tan, .... meet John Baron's help search page:
http://search.r-project.org/

( .... and it apparently gets repeatedly asked and answered over the  
years.)

-- 
David Winsemius

On Nov 25, 2008, at 7:14 AM, Daren Tan wrote:

>
> How can I compute the pearson correlation p-values for all  
> combinations of columns of 2 matrices ?
>
>
>> m <- matrix(rnorm(20), nrow=4, dimnames=list(LETTERS[1:4],  
>> letters[1:5]))
>> m1 <- matrix(rnorm(20), nrow=4, dimnames=list(LETTERS[1:4],  
>> letters[1:5]))
>> cor(m,m1)
>            a          b          c           d           e
> a -0.67533294 -0.2516151 -0.3780815  0.55816011 -0.16526501
> b  0.41729336  0.1078082  0.6671405 -0.81381931 -0.20240428
> c -0.01058068 -0.5069489  0.7723080 -0.79558376 -0.32441411
> d  0.98691269  0.8147252 -0.2853724  0.05879335  0.63893235
> e  0.59140305  0.6746471  0.2835064 -0.47762034 -0.06372043
>
> ______________________________________________
> 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.



More information about the R-help mailing list