The main advantage is that it brings all the key bindings I’m used to. YMMV, but I also really like how easy Rstudio makes it to execute code as I’m iterating, whether in a script or the interpreter. As far as I know, there’s no “Python-first” IDE that does this as well as Rstudio does this for R.
Rstudio also has really nice auto-complete and pop-up documentation:
I like this a lot. Maybe another IDE could have provided it if I kept looking. But Rstudio is what I know, so I was pleased to learn that these features carried over.
I use Conda environments and Conda’s python and spent most of my setup trying to get Rstudio to recognize that.
install and load
create a Conda environment called
r-reticulate(I did this from the command line but
reticulate::conda_create()would work, I think);
Add to your
.Rprofilethe equivalent of
Sys.setenv(RETICULATE_MINICONDA_PATH = '~/miniconda3/')(that’s where my miniconda installation was, and
reticulatehad some trouble finding it);
use_miniconda(condaenv = 'r-reticulate', require = T)will tell R which Python to use and where to find the relevant environment.
From there, Rstudio has a built-in “new Python script” option in the menu, or you can write an Rmarkdown script and specify that a given chunk should be Python.
- Reticulate’s documentation on the Conda front is a work-in-progress, I got a bunch of errors about Python not being found and solving them was a bit unintuitive. But I think if you follow the above steps, it’ll work.
- For my own curiosity, I created an
.Rmdwith R, bash, and Python chunks in order, and found that the R and Python chunks worked out of the box but the bash chunk did not. Turns out that bash chunks in Rmarkdown only work (interactively) when chunk output is inline rather than to console.1
But once I paid those setup costs, it’s been pretty good.
This is kind of a niche use case (maybe not?) but it seems that Jupyter, as a design choice, does not natively support multi-language notebooks, though I see that it’s come up again recently for Microsoft notebooks.↩︎