Choosing Between Rpy2 Or R?
3
2
Entering edit mode
12.0 years ago
Olivier ▴ 440

Hello

I have a python background and I'm interested in learning R [to work with pre-existing microarray data, may be for some data mining (if that's possible)], but I don't know whether rpy2 or R would be better for me in the long run. Would it be better to start with R or its python implementation - rpy2? Are there advantages of one over the other?

Thanks,

Olivier

r python microarray • 6.4k views
ADD COMMENT
0
Entering edit mode

If you are just using R for graphing matplotlib might be easier.

ADD REPLY
0
Entering edit mode

This is a general programming question. Is there some relevance to a specific bioinformatics research problem?

ADD REPLY
0
Entering edit mode

You're right. I'd like to try analyse pre-existing microarray data, for a start, and cluster the data, make graphs, etc... I'd like to be able to do it... Haven't come across a 'standard way' tutorial (at least none that I could understand easily) of going through the microarray data. That's why I'm starting from scratch. May be I should edit the question. Thanks

ADD REPLY
4
Entering edit mode
12.0 years ago
Ben ★ 2.0k

Rpy2 is just an interface to R... It's useful from time to time to invoke an R object or user native R functions within a Python script but it's not a replacement or viable alternative to learning R itself.

ADD COMMENT
4
Entering edit mode
12.0 years ago

The idea with rpy2 is to allow access to the large amount of R code available without requiring to know R.

While this is working fairly well in large majority of cases (given that the ratio number-of-complains / number-of-downloads is close to zero), this is not a complete exoneration from having access to R skills, either yourself or through a collaborator you would work with.

A possible checklist to know whether rpy2 would be useful to you is:

  • development of polyglot prototype applications making use of existing R methods (if pressed enough, I can add shameless plugs to talks where I demonstrate this - you can find some of them on Google otherwise) ?

  • development of applications embedding R and offering complete access to it ? An example of such work is the R magic in ipython

  • hybrid scripts where both libraries only available in R and methods only available in Python are needed ? rpy2 allows relatively good performances, to the point that running that working on R data structures through rpy2 can be faster than working on them through R itself (Python is faster than R, and rpy2 is quite close to the C-API for R - see the benchmark in the rpy2 documentation).

ADD COMMENT
0
Entering edit mode

Links to talks would be helpful, shameless plug or not. And I didn't know about that R magic in IPython, -- that is fantastic.

ADD REPLY
0
Entering edit mode
ADD REPLY
3
Entering edit mode
12.0 years ago
Josh Herr 5.8k

To underscore what Ben said, you'll still have to understand a bit of R to use Rpy2. I don't come from a programming or computer background, so my learning curve has been steep, but I think R has been the easiest language to pick up from day one. I would give R a try; you'll find with a Python background that you'll be able to pick R up quickly. There are tons of great resources (Cookbook for R is a favorite), graphics packages (ggplot2 is quite amazing) and RStudio is the equivalent of iPython notebook, and I love both interfaces and use both on an everyday basis.

ADD COMMENT
1
Entering edit mode
ADD REPLY
0
Entering edit mode

Thanks for the links and suggestions

ADD REPLY

Login before adding your answer.

Traffic: 2505 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6