JetBrains DataSpell 2021.1 Help

R plugin support

With the R plugin installed in JetBrains DataSpell, you can perform various statistical computing using R language and use coding assistance, visual debugging, smart running and preview tools, and other popular IDE features. JetBrains DataSpell supports R 3.4 and later.

With the R plugin, you can also get native support for .R files. Such files are marked with the R file icon icon.

R plugin support in JetBrains DataSpell includes:

  • Coding assistance:

    • Error and syntax highlighting.

    • Code completion.

    • Code refactoring.

    • Ability to create line comments Ctrl+/.

    • Intention actions and quick fixes, including quick fixes for the missing import statements.

  • Auto-saving changes that you make in your files. Saving is triggered by various events, for example, closing a file or a project, or quitting the IDE.

  • Ability to preview data in the graphic and tabular forms.

  • Ability to run and debug R scripts with live variables view.

Quick start with the R plugin in JetBrains DataSpell

To start working the R files in JetBrains DataSpell:

  1. Download and install the R language.

  2. Install the R plugin for JetBrains DataSpell.

  3. Configure an R interpreter.

  4. Inspect the set of the installed R packages and install additional packages required for your project.

  5. Open or create an .R file.

  6. Run the R script.

  7. Analyze, export, and save the results.

Get familiar with the user interface

When you edit and execute R files with the R plugin in JetBrains DataSpell, you should notice the following changes in JetBrains DataSpell user interface:

The R Tools window contains tabs to analyze plots, preview R documentation, and configure R packages. With the R Console, you can monitor R code execution as well as preview variable values.

At any time you can open R Tools and R Console windows by selecting the corresponding option in the View | Tool Windows menu.

R Console

The R Console tab appears in the group of the JetBrains DataSpell tool windows. It enables executing R commands line by line similar to the console provided with the R installation.

Code completion (Ctrl+Space) is available as you type commands in the R Console. You can preview the values of the declared variables and the execution results in the Variables area.

Executing commands in the R console
ItemDescription
Execute the current statementExecute the current statement in the one-line console (Enter ).
Console historyOpen the R Console History to preview the list of the executed commands.
Set current directory form editorOpen any file in the editor, then click this button. The location of the opened file will be set as the current directory for the current console tab.
restart consoleRestart the console session.
Soft wrapSoftly wraps lines in the R Console.
Add a new R ConsoleOpen a new R Console tab.
HelpHelp on executing R scripts.

You can open several tabs in the R console for different tasks. To distinguish between the opened consoles, right-click any tab and enter a specific name.

Renaming a console

In the R console, you can use call the magrittr pipe function, %>%. Press the Ctrl + Shift + M (for Windows and Linux) or Command + Shift + M (for macOS) to insert it.

Using magrittr pipe from the R console

The Jobs tab shows the execution of the jobs initiated for R files. You can preview the job status (succeeded or failed), duration of the execution, and the time you launched the job.

Jobs console

Use the following icons of the Jobs toolbar:

ItemDescription
Add a jobAdd a new job.
Delete jobsClear the list of jobs.
Rerun the jobRerun the job.

Plots

In the Plots tab of the R Tools window, you can preview various graphs built with the R-specific data plotting libraries. The window displays all the graphs built within a single execution session that lasts until you close the R Console or explicitly terminate the process. The graphs are arranged one on a page.

R Graphics
ItemDescription
Previous graphics Next graphicsGo to the previous or next graphics page.
ExportSave the graphics in a .png file.
Copy graphics to clipboardCopy the graphics in the clipboard.
ZoomZoom in the graphics.
ClearClose the currently selected page.
Clear AllClose all graphics pages.
SettingsOpen the Graphics device settings dialog to set up the size of the image and its resolution.

Tables

When you analyze tabular data in the Variables view, you can click the View Table link and preview the table in a separate tab the editor. To order values in a particular column, click its header.

mtcars data in the R table view
ItemDescription
Export tableSave the table in a .csv file.
Filter data

Filter data in the table columns. Hover over the button to preview the available filters and type the filter criteria under the column header.

Available filters
PaginationOrganize table in pages. Toggle this button and specify the number of table rows to display on a page: 10, 15, 30, or 100.

Viewer

With the Viewer tab of the R Tools window you can preview R graphics built with the JavaScript visualization libraries.

Rendering shared graphics in the R HTML window

R packages

Install, uninstall, and update R packages in the Packages tab of the R Tools window. It lists all the installed R packages.

The list of the installed R packages
ItemDescription
Install a packageInstall an R package from the list of the available packages.
Upgrade all packagesUpgrade all packages to the latest available versions. This button is enabled if at least for one of the installed packages there is a newer version.
Refresh the package listUpdate the Latest version column by fetching the latest available versions for the installed packages.

R files toolbar

When you open an R file in the editor, the following toolbar appears. Use it to run and debug R code.

R file toolbar
ItemDescription
Execute the R fileExecute the R file.
Debug the R fileDebug the R file
Run jobRun a job for an R file
Run selectionExecute the selected code fragment
Debug selectionDebug the selected code fragment
DocumentationOpen the Documentation tab.

Markdown toolbar

The toolbar appears the editor window when you open an .rmd file.

r markdown toolbar
ItemDescription
Output directorySelect the directory for the generated HTML output. By default, the project directory is selected. To alter the location, select Custom from the list and specify any directory in your file system.
Render documentRenders the document in the HTML format. The filename corresponds to name of the R Markdown file. The location of the generated file is defined by the option selection in the Output Directory list.
Open documentOpens the generated HTML document. Note that you should build the output first (Render document ).
Run All ChunksRuns all the executable R chunks in the file. During the execution the icon changes its state to Stop execution.
Add a new R chunkInserts a new chunk for R code below the current chunk.
Soft wrapSoftly wraps lines in the editor.

Refer to the following topics for more information about R plugin support in JetBrains DataSpell:

Last modified: 15 June 2021