R plugin support
With the R plugin installed in PyCharm, 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.
With the R plugin, you can also get native support for .R files. Such files are marked with the icon.
R plugin support in PyCharm includes:
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 PyCharm
To start working the R files in in PyCharm:
Download and install the R language.
Install the R plugin for PyCharm.
Create a new R project.
Configure an R interpreter.
Inspect the set of the installed R packages and install additional packages required for your project.
Open or create an .R file.
Run the R script.
Analyze, export, and save the results.
Get familiar with the user interface
When you install the R plugin for PyCharm, you should notice the following user interface elements:
The R Console tab appears in the group of the PyCharm 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.
Execute the current statement in the one-line console (Enter).
Help on executing R scripts.
R Graphics, Table View, R HTML Viewer, and R Packages appear in the Data View tool window. By default, these windows are pinned to the dock and can be previewed one by one. To preview any of these windows simultaneously, change their viewing mode.
R Graphics tool window
In this tool 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.
Go to the previous or next graphics page.
Save the graphics in a .png file.
Zoom in the graphics.
Close the currently selected page.
Close all graphics pages.
When you analyze tabular data in the Variables view, you can click the View Table link and preview them in the Table View window. To order values in a particular column, click its header.
Save the table in a .csv file.
Filter data in the table columns. Hover over the button to preview the available filters and type the filter criteria under the column header.
Organize table in pages. Toggle this button and specify the number of table rows to display on a page: 10, 15, 30, or 100.
Install, uninstall, and update R packages in the R packages window. It lists all the installed R packages.
Install an R package from the list of the available packages.
Uninstall the selected package.
Upgrade the selected package to the latest available version. This button is enabled only when there is a newer version of this package.
Upgrade 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.
Update the Latest version column by fetching the latest available versions for the installed packages.
The toolbar appears the editor window when you open an .rmd file.
Select 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.
Renders 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.
Opens the generated HTML document. Note that you should build the output first ().
Runs all the executable R chunks in the file. During the execution the icon changes its state to .
Inserts a new chunk for R code below the current chunk.
Refer to the following topics for more information about R plugin support in PyCharm: