Combining R and Python
Personally I find Python to be a great general purpose cross platform language (see my Python Pages). However, R has its strengths too, particularly in statistics and graphics.
Calling R from Python
R's rich libraries for statistics and graph creation can be called from within a Python program using RPy (R from Python), written by Walter Moreira and Gregory Warnes. It works on both Linux and Windows.
I have used this to:
- Calculate linear regressions
- As one of several ways to calculate rank correlations.
- Draw heatmaps from Python
- Draw Ramachandran Plots from Python, using filled contour plots with an overlayed scatter plot described here in just R.
- Draing protein contact maps, another contour plot example.
See my python pages for further examples...
Calling Python from R
This should be possible using RSPython, an R/SPlus - Python Interface. I have not tried this yet, mainly because of their weak Windows support. On linux at least, RSPython should allow you to call R from Python, and Python from R - which makes it rather more powerful than RPy.
![[R logo]](/fac/sci/moac/people/students/peter_cock/r/rlogo2.png?maxWidth=125&maxHeight=76)
![[Python logo]](/fac/sci/moac/people/students/peter_cock/python/python_small.png?maxWidth=174&maxHeight=48)
![[RPy logo]](/fac/sci/moac/people/students/peter_cock/python/rpy_small.png?maxWidth=175&maxHeight=69)