I have gotten very used to coding in R and especially in RStudio. I like that interface. Nonetheless, I have some work that I ought to do in Python. I know that I can run Python code in RStudio if I use the "reticulate" package, and I've written some code that has switched between the two. As far as I can tell, anything I could run in Python from the command line or in Jupyter could be done in RStudio with reticulate.

Should I expect to have longer run times using Python commands in R, than I would if I ran Python regularly (whatever "regularly" means)?


1 Answer 1


I actually tested this recently on a random forest fitting using two approaches:

  1. Using Jupyter notebooks to fit my model via python with data that had been tidied in the same notebook also using python.


  1. Using reticulate in a rstudio notebook to fit the same model in python but using a converted dataset I had tidied in r in the same notebook.

I made the following observations:

  1. Native python is faster, in my benchmark it fitted the model ~1 min faster (9 vs 10 mins) on my 16GB Ram laptop.

  2. Additionally you lose some time converting objects between the two languages, especially if we talk about bigger datasets.


In most cases doing r stuff first, saving objects to CSV and then opening jupyter or python command lines to finish a job is not necessary thanks to reticulate.

If you do a repeated or time-critical job try to use python natively but otherwise reticulate is fine especially, if like me you save a lot of time doing prep work in r.

  • $\begingroup$ Great Work! This knowledge is a time saver. Thank you. $\endgroup$ Feb 17, 2020 at 1:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.