To write an R script, one can use R Console, R commander, or any text editor (such as EMACS, VIM, or sublime). However, the assistance of RStudio, an integrated development environment (IDE) for R, can make development a lot easier.
RStudio provides comprehensive facilities for software development. Built-in features, such as syntax highlighting, code completion, and smart indentation, help maximize productivity. To make R programming more manageable, RStudio also integrates the main interface into a four-panel layout. It includes an interactive R Console, a tabbed source code editor, a panel for the currently active objects/history, and a tabbed panel for the file browser/plot window/package install window/R help window. Moreover, RStudio is open source and is available for many platforms, such as Windows, macOS X, and Linux. This recipe shows how to download and install RStudio.
RStudio requires a working R installation; when RStudio loads, it must be able to locate a version of R. You must therefore have completed the previous recipe with R installed on your OS before proceeding to install RStudio.
Perform the following steps to download and install RStudio for Windows and macOS users:
- Access RStudio's official site by using the following URL: http://www.rstudio.com/products/RStudio/
RStudio home page
- For the desktop version installation, click on
RStudio Desktop
under theDesktop
section. It will redirect you to the bottom of the home page:
- Click on the
DOWNLOAD RSTUDIO DESKTOP
button (http://www.rstudio.com/products/rstudio/download/), it will display download page, with the option of open source license and commercial license. Scroll down toRStudio Desktop Open Source License
and click onDOWNLOAD
button:
RStudio Download page
- It will display different installers for different OS types. Select the appropriate option and download the RStudio:
RStudio Download page
- Install RStudio by double-clicking on the downloaded packages. For Windows users, follow the onscreen instructions to install the application:
RStudio Installation page
- For Mac users, simply drag the RStudio icon to the
Applications
folder. - Start RStudio:
The RStudio console
Perform the following steps for downloading and installing RStudio for Ubuntu/Debian and RedHat/CentOS users:
For Debian(6+)/Ubuntu(10.04+) 32 bit:
$ wget http://download1.rstudio.org/rstudio-0.98.1091-i386.deb$ sudo gdebi rstudio-0.98. 1091-i386.deb
For Debian(6+)/Ubuntu(10.04+) 64 bit:
$ wget http://download1.rstudio.org/rstudio-0.98. 1091-amd64.deb$ sudo gdebi rstudio-0.98. 1091-amd64.deb
For RedHat/CentOS(5,4+) 32 bit:
$ wget http://download1.rstudio.org/rstudio-0.98. 1091-i686.rpm$ sudo yum install --nogpgcheck rstudio-0.98. 1091-i686.rpm
For RedHat/CentOS(5,4+) 64 bit:
$ wget http://download1.rstudio.org/rstudio-0.98. 1091-x86_64.rpm$ sudo yum install --nogpgcheck rstudio-0.98. 1091-x86_64.rpm
The RStudio program can be run on the desktop or through a web browser. The desktop version is available for the Windows, macOS X, and Linux platforms with similar operations across all platforms. For Windows and macOS users, after downloading the precompiled package of RStudio, follow the onscreen instructions, shown in the preceding steps, to complete the installation. Linux users may use the package management system provided for installation.
- In addition to the desktop version, users may install a server version to provide access to multiple users. The server version provides a URL that users can access to use the RStudio resources. To install RStudio, please refer to the following link: http://www.rstudio.com/ide/download/server.html. This page provides installation instructions for the following Linux distributions: Debian (6+), Ubuntu (10.04+), RedHat, and CentOS (5.4+).
- For other Linux distributions, you can build RStudio from the source code.