As with other programming languages, there is a huge variety of IDEs available for R. IDEs are applications that make code development easier and clearer for the programmer. RStudio is one of the most important ones for R, and it is especially recommended to write web applications in R with Shiny because this contains features specially designed for this purpose. Additionally, RStudio provides facilities to write C++, Latex, or HTML documents and also integrates them to the R code.
RStudio also provides version control, project management, and debugging features among many others.
RStudio for desktop computers can be downloaded from its official website at http://www.rstudio.com/products/rstudio/download/ where you can get versions of the software for Windows, MAC OS X, Ubuntu, Debian, and Fedora.
Before installing and running RStudio, it is important to have R installed. As it is an IDE and not the programming language, it will not work at all. The following screenshot shows RStudio's starting view:
At the first glance, the following four main windows are available:
.rda
or .RData
file, it will open in both. If it is a text file, it will open in one of them.Along with numerous features, RStudio also provides keyboard shortcuts. A few of them are listed as follows:
Description |
Windows/Linux |
OSX |
---|---|---|
Complete the code. |
Tab |
Tab |
Run the selected piece of code. If no piece of code is selected, the active line is run. |
Ctrl + Enter |
⌘ + Enter |
Comment the selected block of code. |
Ctrl + Shift + C |
⌘ + / |
Create a section of code, which can be expanded or compressed by clicking on the arrow to the left. Additionally, it can be accessed by clicking on it in the bottom left menu. |
|
|
Find and replace. |
Ctrl + F |
⌘ + F |
The following screenshots show how a block of code can be collapsed by clicking on the arrow and how it can be accessed quickly by clicking on its name in the bottom-left part of the window:
Clicking on the circled arrow will collapse the Section 1
block, as follows:
The full list of shortcuts can be found at https://support.rstudio.com/hc/en-us/articles/200711853-Keyboard-Shortcuts.
For further information about other RStudio features, the full documentation is available at https://support.rstudio.com/hc/en-us/categories/200035113-Documentation.