Positron is the new beta Data Science IDE
from Posit. Though Posit have stressed that
maintenance and development of RStudio will continue, I want to use this
blog to explore if Positron is worth the switch. I’m coming at this from
the R development side but there will of course be some nuances from
other languages in use within Positron that require some thought.
And I hope to put out another version of this for Python!
A “polyglot” IDE
Whilst RStudio is an IDE aimed at Data Science using R, Posit say that
Positron is an IDE aimed at “Data Science” using any programming
language i.e. a “polyglot” IDE. At the moment, it’s just R and Python
but with the possibility to extend. Its current target audience is those
Data Scientists who think RStudio is too niche yet VS
Code is too general.
Everything inside the RStudio window, for all its beauty, is run using
one R process. This is why when R crashes, RStudio does too. However,
Positron is built using the same base as VS Code (a fork of Code OSS)
which enables Positron to run R (and Python) through communication with
a kernel. Sparing you the gory details, for us programmers it means we
have the incredible ability to be able to switch between not only
versions of R, but other languages too. All through just two clicks of a
button!
Settings and the command palette
Like RStudio, there is a command palette to manage settings and initiate
operations. Though I confess, I didn’t actually know this about RStudio
until I wrote this blog. That’s also the key difference. In Positron,
the command palette is the primary way to manage settings, and there’s a
very clear prompt at the top of the screen. In RStudio it feels more
like a hidden feature.
Also, by default Positron does not save your .RData to your workspace,
nor does it ask you! You can change this if you want.
Workspaces / R projects
R projects are no longer the main way of grouping files. Instead,
Positron uses workspaces. A workspace is analogous to any folder on your
device. By default the working directory is set to whichever folder you
have open. I’ve found this useful, as it means I don’t need to create an
.Rproj
file to reap (most of the) the benefits of project-based
development. As you can see below, there are a LOT of hints that opening
a folder is the best way to work in Positron.
If you still need an R project file, then Positron provides the ability
to create these too (but it doesn’t really mean anything in Positron).
Layout
The biggest difference in layout is the addition of the sidebar to the
left. This houses the (more advanced) file explorer, source control,
search and replace, debug and extensions. We’ll talk about each one of
these in turn throughout the blog.
The file explorer is a big plus for me. Firstly, it is just easier to
work with and takes up less real estate. But it also directly integrates
with the source control and the R interpreter. This means you have live
feedback for the git status of your files and if your interpreter has
detected any problems. Whilst this is nice, it does mean Positron will
nearly always indicate there’s problems with your code before any code
has been run.
For the configuration of the panes etc, check out the layout options in
the command palette. I’m using the “Side-by-Side Layout” and have
dragged the “variables” and “plots” panes adjacent with the console.
Extensions
As Positron is made from the same stuff as VS Code, we now get VS Code
extensions, but only from the OpenVSX
marketplace. Still, there’s nearly everything you could ever want in
there. Including themes, rainbow CSV, and Git integrations.
Using Git
I think this one will divide people. I very much enjoy the RStudio Git
GUI – the simplicity of it is probably it’s best feature and definitely
what I will miss the most. However, it was limited. Positron’s “source
control” section gives you far more control over what you can do using
Git without having to head to the terminal.
As well as Positron’s built-in Git support, there are extensions too.
There’s a GitLab workflow extension for viewing merge requests, issues
and more and about a million extensions for GitHub. I’m particularly
enjoying the Git Graph extension, which allows me to view the branch
graph in a separate tab. Please enjoy this ridiculous example of a git
branch graph.
Data explorer
Posit have pushed this element of Positron a lot and to be fair, it is
an upgrade on the RStudio data explorer. There aren’t too many
additional features compared to RStudio – it’s probably more of a win
for Python users, who won’t be used to a data explorer. In my opinion,
the welcome new additions are:
- The column summary in the left hand side is a welcome addition and
does make for quicker browsing of data. - The UI design in general. For instance having filters as tabs across
the top instead of above their respective column makes so much sense. - Multi column sorting (!!)
- Larger data sets load into the explorer view much, much quicker.
Debugging and testing
The interface for R package testing has greatly improved, in that there
now is one. You can view all tests from the “Testing” section of the
sidebar whilst being able to jump to and run any tests from this
section.
There is now a completely separate interface for debugging too, with
separate sections for the environment state and call stack. Too many
times have I mistaken my debug environment for my global in RStudio!
During Posit conf, it was announced that within debug mode users can now
jump to and from C code as well though I haven’t tested this out yet.
R-package development
For a more comprehensive analysis of full R package development see
this
blog
by Stephen Turner.
What’s not quite there?
For all the good there are a few things that just aren’t quite there
yet:
- So far there’s no support for RStudio addins.
- Most of the functions that make calls to {rstudioapi} work
(i.e. {testthat}), but there are some that don’t. - The big annoying one for me at the moment is that the console doesn’t
retain code formatting and colour for the results and code once the
code has been run. There is an issue about this and a fix is coming
apparently.
Conclusion
Positron is still a beta product and I’m going to be switching from
RStudio for most of my programming. I would, however, say to anyone
thinking of making the switch, it’s taken me a couple weeks to get used
to the layout and I’m still not sure I have my settings nailed down. But
that will come in time.
For updates and revisions to this article, see the original post
Related