Project page: https://r-forge.r-project.org/projects/rpithon/

Package repositories:


rPithon is a package which allows you to execute Python code from within R, passing R variables to Python, and reading Python results back into R. The functions are based on those from rPython, but the way it works is fundamentally different: in this package, an actual Python process is started and communication with it occurs over a so-called pipe. To exchange data, the rPithon package also makes use of RJSONIO to convert data structures to and from the JSON format.

This approach of communicating with a separate Python process instead of linking Python directly into the current R session, has a few advantages:

Since the Python execution speed is exactly the same, the only disadvantage I can think of is that communication with the Python process could be a bit slower.

As was already mentioned, the R functions are nearly identical to their rPython counterparts, so many thanks to Carlos J. Gil Bellosta for releasing said package.


After loading the package using


there are several functions you can use. The most important ones are pithon.set.executable, pithon.exec and pithon.get :

The other functions are pithon.available, pithon.assign, pithon.call, pithon.load and pithon.method.call, and make use of thepithon.exec and pithon.get functions to accomplish their goals. In each of them, an instance.name parameter can be used to identify a Python process.