[R] Python and R

Esmail Bonakdarian esmail.js at gmail.com
Wed Feb 18 00:59:40 CET 2009

On Tue, Feb 17, 2009 at 6:05 PM, Barry Rowlingson
<b.rowlingson at lancaster.ac.uk> wrote:
> 2009/2/17 Esmail Bonakdarian <esmail.js at gmail.com>:

>  When I need to use the two together, it's easiest with 'rpy'. This
> lets you call R functions from python, so you can do:
>  from rpy import r
>  r.hist(z)

wow .. that is pretty straight forward, I'll have to check out rpy for sure.

> to get a histogram of the values in a python list 'z'. There are some
> complications converting structured data types between the two but
> they can be overcome, and apparently are handled better with the next
> generation Rpy2 (which I've not got into yet). Google for rpy for
> info.

Will do!

>> Is there much of a performance hit either way? (as both are interpreted
>> languages)
>  Not sure what you mean here. Do you mean is:
>  R> sum(x)
> faster than
> Python> sum(x)
> and how much worse is:
> Python> from rpy import r
> Python> r.sum(x)

Well, I have a program written in R which already takes quite a while
to run. I was
just wondering if I were to rewrite most of the logic in Python - the
main thing I use
in R are its regression facilities - if it would speed things up. I
suspect not since
both of them are interpreted, and the bulk of the time is taken up by
R's regression


More information about the R-help mailing list