easy_install -U
pyRserve
).
pyRserve is a (pure python) client for connecting Python to an R process on a remote server via TCP-IP (using Rserve). Through such a connection variables can be get and set in R from Python, and also R-functions can be called remotely. No R-related libraries need to be installed on the client side.
>>> from pyRserve import connect
>>> conn = connect('your R server')
>>> conn.r('1+1') # direct evaluation of a statement
2
>>> conn.r.myList = [1, 2, 3] # bind a list within R to variable 'myList'
>>> conn.r('func1 <- function(v) { v*2 }') # create a function in R
>>> conn.r.func1(4) # call the function in R
16
The documentation for pyRserve is available at http://packages.python.org/pyRserve