RStudio 2022.02.0: What’s New

[This article was first published on RStudio | Open source & professional software for data science teams on RStudio, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This post highlights some of the improvements in the latest RStudio IDE release 2022.02.0, code-named “Prairie Trillium”. To read about all of the new features and updates available in this release, check out the latest Release Notes.

Support for R (>= 4.2.0)

The development build of R, which will be released as R 4.2.0 later this year, features a number of changes. The latest RStudio release supports the most significant of these changes.

Updated graphics engine support

The graphics engine, which is used to render plots in the RStudio Plots pane, has been upgraded to graphics engine version 15 in R 4.2.0. Older versions of RStudio displayed a warning that R graphics engine version 15 is not supported by this version of RStudio and plots opened in a separate window rather than in the Plots pane. In this release, the Plots Pane is fully compatible with R >= 4.2.0.

Windows support

  • R 4.2.0 will use UTF-8 as the native encoding on recent Windows systems, such as Windows 10, Windows Server 2016, or later. Builds of R >= 4.2.0 on Windows use UCRT to support this use of UTF-8. This RStudio release provides support for UTF-8 native encoding on Windows, including listing file paths and directories containing non-ASCII UTF-8 characters that may be common for international users working in other languages and locales.

  • R 4.2.0 soft-deprecated the download method of wininet, which was commonly used as a method of downloading files and installing packages in R on Windows platforms. This release updates the file download method used when installing packages; users will no longer see a warning indicating that the ‘wininet’ method is deprecated when installing R packages via RStudio.

Visual editor improvements

Collapsible code chunks

The visual editor now has the ability to expand or collapse some or all code chunks to make it easier to navigate the document. You can collapse a code chunk by clicking on the code-folding arrow to the top-left corner of each chunk. Each collapsed chunk will display the number of lines of code that have been collapsed. Output can be collapsed independently of the code itself.

An expanded code chunk

A collapsed code chunk

Alternatively, you can use the Command Palette or keyboard shortcuts to collapse or expand a single code chunk, or all code chunks at once. You can collapse a single code chunk with Ctrl + Alt + L, with your cursor in the code chunk, and expand it again with Ctrl + Alt + Shift + L.

Using Command Palette to collapse code

Optional line numbering

Users now have the option to display line numbers, code diagnostic markers, or both in the left-hand margin of each code chunk in the visual editor.

The option to display line numbering in the visual editor is separate from the option controlling line numbering in the source editor, and these line numbers are disabled by default, even if line numbering is turned on in the source editor. To turn on line numbering for the visual editor, go to Tools > Global Options > RMarkdown > Visual and check the box to “Show line numbers in code blocks”.

Enabling line numbers in Visual mode

Each code chunk will now display its own line numbering within the code chunk.

Code chunk with line numberingAlternatively, you can also enable line numbering by opening the Command Palette and searching for “line numbers” to check the setting “Show line numbers in visual mode code blocks”.

Enabling line numbers in the Command Palette

Optional code diagnostics

You can also display code diagnostics within the visual editor, using the same settings to enable these in both the visual editor and the source editor. For more details on enabling and using code diagnostics in general, see the support article on code diagnostics within the IDE.

After enabling code diagnostics for both the visual and source editor in Tools > Global Options > Code > Diagnostics, lines of code detected as potentially having issues will be indicated in the left-hand margin with an Error, Warning, or Info symbol, depending on the nature of the issue.

Enabling code diagnostics in the IDE

For example, in the code sample below, issues are denoted with diagnostic markers next to the line numbers, and for certain issues, the affected code is underlined.

Code chunk with diagnostic markers

By hovering over the associated marker, we can read a message as to the nature of the issue(s) with that line of code. After editing and saving the file, if the issue has been successfully resolved, the marker, and any associated underlining, will disappear.

Diagnostic marker message in tooltip

More Info

There’s lots more in this release, and it’s available for download today. You can read about all the features and bugfixes in the RStudio 2022.02.0 “Prairie Trillium” release in the RStudio Release Notes. We’d love to hear your feedback about the new release on our community forum.

To leave a comment for the author, please follow the link and comment on their blog: RStudio | Open source & professional software for data science teams on RStudio.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)