DataSpell 2023.3 Help

Setup your environment

Before you start

  1. Ensure that you have downloaded and installed R.

  2. Ensure that the R Language for IntelliJ plugin is installed and enabled.

At this point, you are all set to start coding in R, still you might want to modify some project settings to tailor them for your needs.

Change an R interpreter

  • To create an R interpreter for your project, click the R interpreter selector in the Status bar and select Local Interpreter.

    Adding a new R interpreter

    Then specify a path to the R executable.

  • Alternatively, press Ctrl+Alt+S, go to the Settings | Project | R Settings dialog, click Add an R interpreter, select Add, and specify a new R executable for the project interpreter.

Create a remote R interpreter

  1. To create a remote interpreter, do one of the following:

    • Click the R interpreter selector in the Status bar and choose On SSH from the menu.

      Adding a new remote interpreter
    • Press Ctrl+Alt+S and go to the Settings | Project | R Settings. Click the Configure interpreter and select Add remote.

  2. In the Add remote R interpreter specify the remote host. You can select it from the list of the available SSH configurations or click the ... button to create a new one:

    New SSH configuration

    Fill in the parameters and click Test connection to verify them. Click OK to proceed.

  3. Specify the path to the R executable on the remote host and the working direcoty. Then, save the changes.

    Adding a path to the remote interpreter

    Once the remote interpreter is set, its remote status will be shown in the interpreter's name in list of the available R interpreters, and in the title of the R console.

Manage R packages

To configure R packages for the project, select the R Packages tab in the R Tools window.

The list of the installed R packages
  • Click Install a package to add a new package. In the Available Packages dialog, type the name of the target package in the Search field, then select a package, and click Install.

  • If needed, you can update packages to a newer versions. Click Refresh the package list to preview the latest available versions of the installed packages, then click

    Upgrade all packages

    .

    When upgrading all packages to the available latest versions, DataSpell shows you the list of the packages to upgrade and asks to confirm the action. Click OK to proceed with the update.

    The list of the packages to upgrade
  • Click Uninstall the package next to a particular package to uninstall it for the current project. Mind checkboxes in the leftmost column: they show the packages loaded into the current execution session.

  • At any time you can open the package source by clicking Package source for the target package.

  • To preview documentation for a particular package, click its name in the Package column. The package reference will be shown in the Documentation tab.

Configure R templates

  1. File templates specify default contents to be generated when creating a new file. To establish the unified style and initial code for all .R files, press Ctrl+Alt+S to open project Settings, go to Editor | File and Code Templates, select R Script in the list of languages, and alter the default template. In the following example, we modified the default settings and added the ${TIME} variable to include the time when the file was created.

  2. Similarly, setup a file template for R Markdown files.

  3. By using live templates, you can insert frequently used constructions into your code, for example, loops, conditions, various declarations, or print statements. To preview the R constructs, press Ctrl+Alt+S to open project Settings, go to Editor | Live Templates, select R Script in the list of languages

When you work with R plugin in DataSpell, all scope of your R data is considered an R workspace.

Manage your R workspace

  • To tune the way you want to operate with R data, press Ctrl+Alt+S and go to the Settings | Project | R Settings dialog.

  • Select Load workspace on R startup to ensure all your R content becomes available when you start DataSpell with the R plugin.

  • Select Save R workspace on exit if you want to save all R data generated during the current session in your workspace.

To execute your R scripts on the remote environment, create a remote configuration and set is as an R interpreter.

Last modified: 11 February 2024