This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Choosing Between Rpy2 Or R?

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

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

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

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

3 answers

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.

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).

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

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.

Thanks for the links and suggestions

Log in to answer this question.