This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Run python scripts (classes and methods) in "R"

I am new to R and need suggestion:

I want to run python scripts (classes and methods) in "R", someone please suggest

R packages (other then rPython) with full documentation to perform this task,

smoothly and reliably. Thanks

python r
  1. Egads why?
  2. Are you sure this is a bioinformatics question...

Should not this question be closed as it is remotely not associated with Bioinformatics or any packages that might be used for any bioinformatics task. I am sure it is an important technical question and one should address the query but there are other technical forums like stackoverflow (http://stackoverflow.com/) or python mailing lists (https://www.python.org/community/lists/) or even quora (https://www.quora.com/) that might guide much better way and we stick to the guidelines of the forum.

2 answers

You may be able to run R in Python but I don't think you can run Python in R.

Also if you are new to R then focus on learning R rather than trying to embed Python. That will just confuse you even more.

I don't think you're going to get a reliable package to call Python code and return R objects (which is what it sounds like you want). While technically embedding python in other languages can be done through conversion to C data structures and back, I think no one really wants to do this. Your best bet is to learn how to make system calls using R, and calling your python script directly - then capturing the return data from the script on stderr or stdout using the system2 function.

Though on a second thought it would be really nice to use python inside R ;-)

Log in to answer this question.