Search code examples
pythonrrpy2pyrservepyper

How do Rpy2, pyrserve and PypeR compare?


I would like to access R from within a Python program. I am aware of Rpy2, pyrserve and PypeR.

What are the advantages or disadvantages of these three options?


Solution

  • I know one of the 3 better than the others, but in the order given in the question:

    rpy2:

    • C-level interface between Python and R (R running as an embedded process)
    • R objects exposed to Python without the need to copy the data over
    • Conversely, Python's numpy arrays can be exposed to R without making a copy
    • Low-level interface (close to the R C-API) and high-level interface (for convenience)
    • In-place modification for vectors and arrays possible
    • R callback functions can be implemented in Python
    • Possible to have anonymous R objects with a Python label
    • Python pickling possible
    • Full customization of R's behavior with its console (so possible to implement a full R GUI)
    • MSWindows with limited support

    pyrserve:

    • native Python code (will/should/may work with CPython, Jython, IronPython)
    • use R's Rserve
    • advantages and inconveniences linked to remote computation and to RServe

    pyper:

    • native Python code (will/should/may work with CPython, Jython, IronPython)
    • use of pipes to have Python communicate with R (with the advantages and inconveniences linked to it)

    edit: Windows support for rpy2