Appendix: Installation

This appendix provides some details for installing R on Windows, OS X, and Linux distributions. Instructions for installing the Rtools component required for building R packages on Windows are also provided. Up-to-date instructions are maintained on the book’s website, http://www.mango-solutions.com/wp/teach-yourself-r-in-24-hours-book/.

Installing R

R is installed from a central repository named CRAN. Most users typically navigate to CRAN via www.r-project.org, although you can also navigate directly to CRAN.

1. Click the “download R” link on the R Project main page.

2. Choose the most local CRAN mirror. Each mirror is exactly the same, so it does not actually matter which one you choose, although it helps reduce traffic if you choose a local mirror.

3. From the main home page of CRAN, there are three options, depending on your operating system. Click the appropriate link.

Installing R on Windows

The following steps describe the process of installing R on Windows:

1. There are three available “subdirectories.” Click the link to “base.”

2. At the top of the page the most recent R release on Windows is available for download via a link—for example, “Download R 3.2.2 for Windows.” Click the link to download the installer to a temporary location (or choose “run” if presented with the option).

3. Choose your language and follow the instructions in the wizard.

Image When presented with the option to configure startup options, as shown in Figure A.1, it is advised that you select No and accept the defaults.

Image

FIGURE A.1 Startup Options

Image Keep clicking Next through all the options, assuming you are happy with what the wizard is going to do.

Image When you are ready, click the Finish button.

Installing R on Mac OS X

Carefully read the notes at the top of the page before downloading R on OS X.

The first link under the Files heading contains a link to the most recent version of R available on OS X—for example, R-3.2.2.pkg. Select this link and run the installer.

1. Once the file has downloaded, run the .pkg file.

2. Choose your language and follow the instructions in the wizard.

Image Keep clicking Next through all the options, assuming you are happy with what the wizard is going to do.

Image When you are ready, click the Finish button.

Installing R on Linux

Choose the appropriate link for your Linux distribution. Each distribution contains its own instructions and/or README file for installing R. For Debian and Ubuntu, the latest stable version of R is available in official repositories. An example of the help for Ubuntu is shown in Figure A.2. Detailed instructions for downloading and installing R are provided on the home page.

Image

FIGURE A.2 Installing R on Ubuntu

Installing Rtools for Windows

Building packages requires a number of additional command-line tools that are not available by default on Windows. You can access them by installing Rtools, a set of development utilities available on CRAN. Linux users will typically install r-base-dev (Debian) or similar in the same way you would install R. OS X users will typically need to install XCode, available via the AppStore, and then install Command Line Tools from within XCode. Up-to-date instructions for installing these additional components are maintained on the book’s website, http://www.mango-solutions.com/wp/teach-yourself-r-in-24-hours-book/.

You can navigate directly to CRAN. Otherwise, start by navigating to the R-Project website.

1. Click the “download R” link.

2. Choose the most local CRAN mirror.

From the main home page of CRAN:

1. Click the Download R for Windows link.

2. Click the Rtools link (https://cran.rstudio.com/bin/windows/Rtools/).

3. There is a table of Rtools versions available for download. You must install the correct version of Rtools for the version of R you are using. The “R Compatibility” column lists which versions of R are appropriate for each Rtools release. See Figure A.3 for an example.

Image

FIGURE A.3 Rtools download table

As an example of which version to download, if you are using R 3.1.2, you will need to install Rtools31.

4. Click the appropriate version of Rtools.

5. If you are asked whether you wish to run or save the .exe file, choose “run.”

6. Once the file has downloaded, click Run.

7. Choose your language and follow the instructions in the wizard. Pay attention to the following:

Image When you are asked to choose a location for the installation, as shown in Figure A.4, Rtools typically downloads directly to C:. If you wish to change this, do so at this point. It is good practice to include the version number (excluding the period) in the name of the destination directory. For example, save Rtools 3.3 to Rtools33. This will help keep track of Rtools versions when you are working with multiple versions of R.

Image

FIGURE A.4 The Select Destination Location screen

Image In order to build C .dll files, ensure that all components are selected when you are presented with this option. Do not install the “Extras to Build 32 bit R: TCL/TK” or “Extras to Build 64 bit R: TCL/TK” unless you actually intend to do so (it is not advised that you do).

Image During the install process, you will be asked if you want to update your system path (see Figure A.5). This is important to be able to build packages; if you choose not to let the install process handle this, you will need to add it manually. Check the box to save the version information to the registry.

Image

FIGURE A.5 The Select Additional Tasks screen

8. When you are ready, click the Install button.

Installing the RStudio IDE

RStudio is installed from RStudio’s own website, www.rstudio.com. Please be aware that these instructions may change as RStudio changes its website. Specifically, buttons may be moved or their names changed.

1. The RStudio home page has traditionally contained one or more obvious links in order install the RStudio IDE. The IDE is currently available via a link that states “Powerful IDE for R.” Select the link to take you to the RStudio IDE download page.

2. You are presented with the option of installing the Desktop or Server version of the IDE. Select the “Desktop” link (see Figure A.6).

Image

FIGURE A.6 Install RStudio Desktop button

3. The “Desktop” link takes you to the appropriate section of the page, where you are presented with the option to download the Open Source edition or the Commercial License version. Assuming you do not wish to purchase the commercial version at this time, click the DOWNLOAD RSTUDIO DESKTOP button.

4. Clicking the DOWNLOAD RSTUDIO DESKTOP button takes you to a page with a number of links to installers for the open-source version of RStudio Desktop. Scroll down through the page until you see an installer that is appropriate for your operating system (for example, RStudio 0.99.484 – Windows Vista/7/8/10). Click the link to download the installer.

5. Run the installer. If you are on Mac OS X, you are presented with an install wizard:

Image Navigate through the wizard, clicking Next to accept the default options.

Image When you are ready, click the Finish button to install RStudio.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset