The world’s leading publication for data science, AI, and ML professionals.

What’s new in RStudio v1.4 (Preview)

Python Support, Visual RMarkdown Editing and a lot of cool stuff

Photo by Christopher Gower on Unsplash
Photo by Christopher Gower on Unsplash

Less than six months ago RStudio released its last stable version (1.3), but a preview of the features that will reach version 1.4 of RStudio has recently been published. It seems that we are going to have important news regarding two key points: the Visual Edition of documents with markdown and the use of Python.

If you want to try in advance the new release, follow the link and download the preview (not definitive nor stable) version of the software:

RStudio Preview

It seems we’ll have important changes and new features in this 1.4 release:

  • A new visual editor for R Markdown documents
  • Improved support for Python, including an environment pane for Python and visualization of Python objects
  • Workbench productivity improvements, including a command palette and rainbow parentheses
  • A more configurable workspace with additional source columns and improved accessibility
  • Support for SAML and OpenID authentication, and experimental support for VS Code sessions, in Rstudio Server Pro

You can read the whole release notes on their website.

Let’s dig in!

✍️ Visual Markdown Editing

R markdown is the reason I keep using Rstudio on daily basis. From version 1.4 this feature is integrated more deeply into the system, allowing you to see dynamic changes in your document without knitting the document every two minutes.

Source: RStudio
Source: RStudio

This change is not mandatory and you can switch back from the visual editor to the classic R markdown documents with the use of a single button in the top-right of the editor toolbar.

Anything you can express in pandoc markdown (including tables, footnotes, attributes, etc.) can be edited in visual mode. Additionally, there are many productivity enhancements aimed at authoring technical content like embedded code, equations, citations, cross-references, and inline HTML/LaTeX.

Let’s see a couple of new features:

Citations

Visual mode uses the standard Pandoc markdown representation for citations (e.g. [@citation]). Citations can be inserted from a variety of sources:

Source: RStudio
Source: RStudio

If you insert citations from Zotero, DOI look-up, or a search, they are automatically added to your document bibliography.

This will make writing a report a lot faster.

Tables

Now you have a dedicated section to deal with tables. Insert them, edit them, do whatever you usually do, but faster.

Source: Author
Source: Author
Souce: Author
Souce: Author

No more stupid inline painting like:

Latex

The new visual editor applies to equations too. Now you can write latex formulas and see immediately if missed some curly bracket as I do.

Source: RStudio
Source: RStudio

To see all the features of the new visual editor go check the beautifully written documentation.

🐍 Python Integration

The RStudio 1.4 release introduces a number of features that will further improve the Python editing experience.

When working with reticulate, one normally selects a Python interpreter using reticulate functions – for example, via reticulate::use_python(..., required = TRUE) or by setting the RETICULATE_PYTHON environment variable. (Or, alternatively, they trust reticulate to find and activate an appropriate version of Python as available on their system.)

However, one might want to control the version of Python without explicitly using reticulate to configure the active Python session. RStudio now provides a Python options pane, available both globally (via Tools -> Global Options...), or per-project (via Tools -> Project Options...), which can be used to configure the default version of Python to be used in RStudio.

Within the Python preferences pane, the default Python interpreter to be used by RStudio can be viewed and modified:

Source: Author
Source: Author

Additionally, The RStudio environment pane is now capable of displaying the contents of Python modules when the reticulate REPL is active. By default, the contents of the main module are displayed.

Source: Author
Source: Author

🔎 Command Palette

A command palette is a software affordance that gives instant, searchable access to all of a program’s commands.The palette can be invoked with the keyboard shortcut Ctrl + Shift + P (Cmd + Shift + P on macOS).

It’s also available on the Tools menu (Tools -> Show Command Palette).

First and foremost, the command palette serves as a way to search for and invoke RStudio commands quickly with just a few keystrokes. Every RStudio command is in the palette unless it’s been explicitly hidden in the current mode. It will improve speed as it is often much faster to invoke a command from the palette with a few quick keystrokes than to reach for the mouse or drill into a menu.

🌈 Rainbow Brackets

Have you ever missed closing a bracket in a long function or editing your code (or copypasting from StackOverflow)? Now, this could be a nightmare of the past.

In the global options panel, you can now enable the rainbow parenthesis options:

Source: Author
Source: Author

And this will be the results:

Source: Author
Source: Author

It works both on R and Python Scripts and it will make parenthesis matching super easy.

References

Editor Visual – https://blog.rstudio.com/2020/09/30/rstudio-v1-4-preview-visual-markdown-editing/

Python – https://blog.rstudio.com/2020/10/07/rstudio-v1-4-preview-python-support/

Command Palette – https://blog.rstudio.com/2020/10/14/rstudio-v1-4-preview-command-palette/


Related Articles