R + Python in IDE

This is incredible, thank you so much for sharing!

Thanks @Cyril, but that's not exactly what I was looking for... I'd like to use Python natively in RStudio, just as if I was using R, with all the tools RStudio has for R available for Python. To all the others who have posted, thanks a lot for the suggestions. I knew I could run other languages in RMarkdown chunks, and I know there are packages to run Python in R and vice-versa, but the question was really more about RStudio itself -- to be able to use Python in RStudio, as if I was using R. The reason I asked it is because I really like RStudio and I don't particularly like any of the ways I can run Python (terminal w/ script, IDE (PyCharm etc), Jupyter etc. etc.). Thanks, though!

1 Like

Like you I had a dream of a day when Python will be perfectly integrated on RStudio ... Not an easy task for RStudio development team. .... Perhaps in following releases ? .... Meanwhile I'm satisfied with RStudio Terminal (upcoming feature of v 1.1) and PythonInR (not more complicated than submiting SQL queries to DBMS). Have you tried to post a request feature to development team ?

Totally :grin::grin: ...dreaming of the perfect IDE for data analysis...RStudio is almost there!

1 Like

I did not know about that but I use myself to with python from R the reticulate :package: from RStudio and it have a nice integration in the IDE in last preview version of RStudio IDE.

Did you try? Is it something similar in scope or are their aby differences?

1 Like

@cderv : I took a quick glance at reticulate.

Reticulate unique feature :

  • matching between Python Object Oriented Programming and R one (use of "" for field attribute, ...) _PythonInR workaround_ : define one (or multiples ?) new Python function(s) that flatten OO field resolving, or better extend the "" operator in R.

PythonInR unique feature :

  • data type conversion for both NumPy and Pandas (last one has dataframes, the first one has matrix)
    reticulate workaround : define one (or multiples ?) new Python function(s) that do the conversion, or extend R language to indirectly call Python for conversion (see. R help for "setAs" methods).

I think both are similars. YMMV.

2 Likes

Not sure it is on topic: I recently stumbled upon Language Server Protocol http://langserver.org/ (while reading about http://blog.atom.io/2017/09/12/announcing-atom-ide.html), but TBH I'm far from fully understanding what it is about. Though I cannot help but notice plenty of languages are supported, but no mention of R.

Could someone more knowledgeable try an explanation, and also is it of relevance to RStudio somehow?

To be honest, Sublime Text 3 is pretty good, but it doesn't have much at install. You have to setup your own REPL with its key binding. The upside is that ST 3 is light and versatile.

I tried to talk to the guys at Sublime Text, they seem to have other priorities---as it is a universal editor. A robust REPL is not one of them.

Thanks! nice to know that. I probably stick with reticulate as it has an integration in RStudio IDE.
However, I will try both myself to make an opinion. Thank you again @Cyril! :+1:

PyCharm is pretty good too.

It's great.It will help us to analyze the data considering languages between R and Python

Did you find any speed differences?

Nope. But, sure, this could be interesting to make a quick bench.

The good point, is that conversion is done with data kept in memory with both packages.
So this should be relatively fast.

I couldn't help but click on the typo'd link just to see the counter increment :joy:

The Beaker Notebook is something also to consider.

So I've been trying to use RStudio (Server v1.1.383) a bit lately with some really pleasant surprises and some real frustrations.

Pros:

  • the integrated terminal + ipython is awesome (and sending code from one to the other)
  • the built in Python snippets in RStudio are fantastic
  • syntax highlighting

Cons:

  • no auto completion
  • no static analysis

I think those cons could be easily addressed by adding Jedi (or alternative) as a plugin for RStudio. Is that non-trivial to do? I tried searching for ways to do it myself and didn't have much luck.

1 Like

No, you can't add an add-in to RStudio to do this; RStudio add-ins can only run on demand and have fairly limited access to the IDE.

RStudio also doesn't have a fully user-extensible completion system. We are however hoping to improve Python support significantly in the next release, so stay tuned!

10 Likes

Emacs has syntax highlighting for any language. And code blocks in org-mode (org babel) will run in any language and export code and/or output to html, pdf, etc. with pandoc. So it is kind of rmarkdown, but language agnostic (so you can have blocks in R, html, python, shell, etc. in the same file).

2 Likes

On March 26 2018 RStudio announced "reticulate: R interface to Python"

Learn more about reticulate at its website; R Interface to Python or via github.com/rstudio/reticulate.

4 Likes