Announce: RPy (R from Python)
Walter Moreira
wall at adinet.com.uy
Fri Mar 8 09:35:07 EST 2002
Hello.
I wrote a small extension module for using the R programming language from
within Python. It makes it possible to use the huge mathematical and
statistical library of R from Python, almost whitout any changes from the text
of R manuals.
As a side effect, it is also possible to use the full graphics capabilities of
R, which are extremely good.
You can download it from:
http://www.cmat.edu.uy/~walterm/rpy
It is in distutils format. I attach a fragment of the README below.
Regards:
Walter
--
--------------
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
Linux/Unix.
This code is inspired in RSPython from the Omegahat project
(http://www.omegahat.org/RSPython).
[...snip...]
3. USING RPy
For details see the file USING. As a quick example, try the following
session:
>>> 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
on
http://www.r-project.org
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.
More information about the Python-list
mailing list