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

New Release of RStudio

An Overview of the Most Interesting Features of RStudio 1.4

Photo by bruce mars on Unsplash
Photo by bruce mars on Unsplash

RStudio, the most widely used IDE for R programming, just got better. You should update it now.

This week brought a piece of good news for the R-users – RStudio preview released a major, new version 1.4. Since version 1.2, RStudio is naming its releases after a flower’s name. Version 1.4 is called "Wax Begonia." It came with some really cool features, in terms of code-readability, document writing, and integration of Python objects.

Installation

  • New Users: You can download a free RStudio Desktop version here for Windows, macOS, and several Linux distributions.
  • Existing Users: Launch RStudio, navigate to the "Help" menu on the top, and then "Check for Updates." You will need to restart RStudio.

Let’s have a look at some of the highlight features.


Photo by Todd Cravens on Unsplash
Photo by Todd Cravens on Unsplash

1) Rainbow Parentheses

Often while writing big chunks of code, you lose track of the nested parentheses. Sometimes, when your code has ten pairs of parentheses, and you get an "unmatched parentheses" error, you often resort to multiple indentations to debug your code. RStudio finally introduced "Rainbow Parentheses." I rate this as the best feature in this version in terms of code-readability enhancement.

Now, the matching pairs will be highlighted in the same color as shown in the screenshot below. The parentheses even change colors dynamically as you add more parentheses. This page shows how to activate this feature.

Sample code showing the rainbow parentheses option of RStudio 1.4
Sample code showing the rainbow parentheses option of RStudio 1.4

If you hate rainbows and are not happy with the default coloring scheme, you can create your custom theme by following this article.


Photo by David Clode on Unsplash
Photo by David Clode on Unsplash

2) Improved Python Integration

The world of Data Science is mostly bifurcated into Python and R, the former being the diversified leader. I come from a Python background with an affection for Jupyter. It took me quite some time to get acquainted with the analysis and visualization of R DataFrames. I was also jealous of RStudio for its ease of viewing the DataFrames (can conveniently sort and filter things).

RStudio 1.4 introduces several additions to the Python support:

i) Choosing Python Interpreter

You can now choose the default Python Interpreter for compiling your Python code, written within the RStudio, from the ones installed on your system. The documentation on how exactly to do this is inadequate, though. I ran into this issue.

ii) Python Support in the Environment Pane

Similar to R, the environment pane can now display the contents of Python variables, objects, and functions. Below, you can see the environment pane that displays the content of variables (constants, lists, dictionaries, etc.), python modules, and the user-defined functions (like "square").

Environment pane showing Python objects in RStudio 1.4.
Environment pane showing Python objects in RStudio 1.4.

iii) Viewing Python Objects (Pandas DataFrames too)

In R, you can view objects (list, vector, DataFrame, etc.) using View(object). Likewise, you can now also view Python objects. Python users who are willing to use RStudio for data analysis/science can rejoice that they can now also visualize Pandas DataFrames inside RStudio. The following image shows the output of View(result), where "result" is the list created above. It also shows the data type of variables (tuple, list, int, str, etc.).

Viewing a Python object in RStudio 1.4.
Viewing a Python object in RStudio 1.4.

iv) Rendering Matplotlib and Seaborn Plots

Good news for the Matplotlib diehards like me.

You can now visualize Matplotlib-generated plots (only non-interactive plot support at the moment) in RStudio. One can also visualize Seaborn-generated plots (Seaborn is a data visualization library that provides an API on top of Matplotlib).

Unfortunately, I cannot load these modules in RStudio momentarily due to this issue. You can check out sample codes and plots here.


Photo by Steve Johnson on Unsplash
Photo by Steve Johnson on Unsplash

3) New Command Palette

A new feature called Command Palette is introduced that aims at quick and improved keyboard accessibility of commands, options, helps, settings, etc.

It derived its name from an artist’s color palette based on its multipurpose nature. You can pop it up using the key combination ctrl + shift + P. The default options would look like in the following image. You can see that they are mostly related to creating new, blank files.

How to search beyond the default results?

You can type queries (one or more words separated by space). Suppose you want help regarding functions. The following shows the option that you get on typing "Function" as the search keyword. Several "Settings" pop up that you can toggle "On" or "Off." It is quite a handy feature, negating the need to search cluelessly through the Tools or Menu options.

Search results in the command palette for the keyword "Function".
Search results in the command palette for the keyword "Function".

The following image shows the result for the search keyword "Data." The search results tagged as "Help" opens in a browser on being clicked, taking you to the corresponding help page (mostly as pdfs).

Search results in the command palette for the keyword "Data".
Search results in the command palette for the keyword "Data".

Photo by Eric Prouzet on Unsplash
Photo by Eric Prouzet on Unsplash

4) Multiple Source Columns in the IDE Workbench

Terminal and iTerm2 users might have used the feature of splitting the workspace vertically in separate windows. It avoids constantly switching among tabs, allowing comparison of several adjacent documents, code, data, etc.

Now, RStudio allows you to similarly configure your workspace window with up to a maximum of three additional source columns (where you can open scripts). It proves very useful in comparing two or more codes or referring to another code/s. I show below how the RStudio workspace looks like on adding two extra columns.

Note: You will only have a single Console that will display the output of the column you select (by clicking inside it) and execute. The selected column (contains first_notebook.R in the image below) is highlighted by a thin, blue, dashed line. The original column in the image contains the "result" window. Any extra column can be closed by closing all the file tabs inside it.

RStudio workspace having two additional columns with Python and R scripts, respectively.
RStudio workspace having two additional columns with Python and R scripts, respectively.

Photo by Taras Shypka on Unsplash
Photo by Taras Shypka on Unsplash

5) New visual markdown editing mode

It is a huge feature that deserves a dedicated post. It comes in quite handy for creating nicely-formatted documents and articles within the RStudio workspace. The new editing mode introduces several new features that include:

  • Real-time spell checking
  • Inserting tables, hyperlinks, code blocks, etc. **** in the document
  • Citation/reference support from several bibliographic sources such as Zotero, Crossref, PubMed, enabled-search using DOI, titles, etc.
  • Ability to write LaTeX equations, footnotes, LaTeX-like cross-referencing to figures, equations, sections, subsections, etc. within the markdown document

Check out the comprehensive highlights of the new visual markdown here.

A sample document prepared in the markdown editor in RStudio 1.4.
A sample document prepared in the markdown editor in RStudio 1.4.

Conclusion

RStudio version 1.4 is a preview release. For academicians and others who often prepare scientific and technical reports, the new visual markdown editing mode is a boon. The improved data visualization ability with the integration of Matplotlib and Seaborn just increased the usefulness of the RStudio manifold for data analysts who mostly use Python for data visualization. This version is likely to attract many Python fans like me who work routinely with data analysis and modeling. A complete list of release notes is available here.


Related Articles