R + Python = Rython

Enough! Enough with that pointless R versus Python debate. I find it almost as pointless as the Bayesian vs Frequentist “dispute”. I advocate here what I advocated there (“..don’t be a Bayesian, nor be a Frequenist, be opportunist“).

Nowadays even marginally tedious computation is being sent to faster, minimum-overhead languages like C++. So it’s mainly syntax administration we insist to insist on. What does it matter if we have this:

Or that


Besides, I freely admit, I am most proficient in stackoverflow tab-opening (still working on tab-closing..) where I often find the syntax I need.

I am being a bit blatant for the sake of stimuli; there are differences between R and Python of course. I just don’t believe they warrant any passionate reactions as I sometime encounter. For a good framework for comparison, have a look at Norman Matloff‘s R vs. Python for Data Science page. Not so much for real decision making, but more because it’s nice to think about the things one should consider when it comes to scripting tools- the framework for comparison.

You are not married to R nor you are married to Python. Be opportunist and use them both for their advantages. Ecosystem goes a long way. Both languages are backed by strong communities which complement each other, in my opinion. For example, I find voice analytics and computer vision to be a bit easier in Python, while advanced statistical algorithms to be better supported\documented in R. Probably a matter of (ancestral) users’ culture- R more academic while Python has more operational flavor.

How best to combine?

I LOVE Rstudio. The company, employees and leadership, and naturally their products and services. The Rstudio IDE is my go-to for all things Rython. Below you can find some help on how to set up the integration.

How to set it up?

I assume you have both Rstudio and Python installed on your machine. You need to direct the reticulate package to your python executable file. But where is it? First you need the path. Here is how one way to find it:

    Open command prompt (you can search cmd from the start menu). Type:

  • python
  • import sys
  • print(sys.executable)
  • Like so:
    terminalscript

  • This will give you the path to your python.exe.

Here are some additional help commands:

You can open a notebook and have two different chunks: an R chunk or a Python chunk:

The IDE will care for what’s what:

Here you can find more or less everything else you may need, including concise but sufficient examples. Feel free to add additional relevant links in the comments.

Do Rython, and have fun!

2 comments on “R + Python = Rython”

Leave a Reply

Your email address will not be published. Required fields are marked *