[R] Announce: R from Python
walterm at cmat.edu.uy
Wed Mar 6 21:46:35 CET 2002
I'm not a regular subscriber in this mailing list, but I think that this
announce may interest somebody. Please, forgive me if this is the wrong place.
Based on the code of RSPython, but modifying it a little, I wrote an interface
for using R from Python. The main reason for writing it was to make it robust,
in order to avoid segmentation faults. Also, it is (IMMO) a very transparent
interface between Python and R.
It is downloadable from
I attach a fragment of the README.
Walter Moreira <> Centro de Matematica <> Universidad de la Republica
email: walterm at cmat.edu.uy <> Home Page: http://www.cmat.edu.uy/~walterm
RPy 0.1 - Python interface to the R Programming Language
1. WHAT IS RPy?
RPy is a very simple, yet robust, interface to the R Programming Language
(http://www.r-project.org). It can manage all kinds of R objects and can
execute arbitrary R functions (including the graphic functions). All the
errors from the R language are converted to Python exceptions. Any module
that later were installed on the R system, can easily be used from within
Python, without introducing any changes. Currently it works only under
This code is inspired in RSPython from the Omegahat project
3. USING RPy
For details see the file USING. As a quick example, try the following
>>> from rpy import *
>>> l = [r.dchisq(x, 4) for x in r.seq(0, 10, by=0.1)]
>>> r.par(ask=1, ann=0)
>>> r.plot(l, type='lines')
and voila!, the graph of the density of a chi squared distribution with 4
degrees of freedom should appear. Refer to the file USING for more info on
the interface, and to the R Programming Language manuals, which can be found
In general, every line of the R manuals can be translated almost directly to
Python. See the conversion directives in section 5 of file USING.
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help