'Correlation analysis between 2 datasets using R or python

Dataset 1

ID Protein1 Protein2 Protein3    
1    
2    
3    
...

Dataset 2

ID RNA1 RNA2 RNA3    
1    
2    
3
...

How do I write a script that can look at the correlation between each pairwise of protein columns in dataset1 and RNA columns in dataset2 matched by ID?

What I want for output is like:

Interaction            Correlation Coefficient    
Pritein1-RNA1     
Protein1-RNA2    
Protein1-RNA3    
Protein2-RNA1    
Protein2-RNA2    
.......

Thanks for your help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source