Posts Tagged: rserve


7
May 10

Connecting R and Python

There are a few ways to do this, but the only one that worked for me was to use Rserve and rconnect. In R, do this:

 
install.packages("Rserve")
library(Rserve)
Rserve(debug = FALSE, port=6311, args=NULL)

Then you can connect in Python very easily. Here is a test in Python:

 
rcmd = pyRserve.rconnect(host='localhost', port=6311)
print(rcmd('rnorm(100)'))