Skip to main content

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:

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.