Getting and Installing Interactive R Binaries

R has been ported to every major desktop computing platform. Because R is open source, developers have ported R to many different platforms. Additionally, R is available with no license fee.

If you’re using a Mac or Windows machine, you’ll probably want to download the files yourself and then run the installers. (If you’re using Linux, I recommend using a port management system like Yum to simplify the installation and updating process; see Linux and Unix Systems.) Here’s how to find the binaries.

  1. Visit the official R website. On the site, you should see a link to “Download.”

  2. The download link actually takes you to a list of mirror sites. The list is organized by country. You’ll probably want to pick a site that is geographically close, because it’s likely to also be close on the Internet, and thus fast. I usually use the link for the University of California, Los Angeles, because I live in California.

  3. Find the right binary for your platform and run the installer.

There are a few things to keep in mind, depending on what system you’re using.

Windows

Installing R on Windows is just like installing any other piece of software on Windows, which means that it’s easy if you have the right permissions, difficult if you don’t. If you’re installing R on your personal computer, this shouldn’t be a problem. However, if you’re working in a corporate environment, you might run into some trouble.

If you’re an “Administrator” or “Power User” on Windows XP, installation is straightforward: double-click the installer and follow the on-screen instructions.

There are some known issues with installing R on Microsoft Windows Vista. In particular, some users have problems with file permissions. Here are two approaches for avoiding these issues:

  • Install R as a standard user in your own file space. This is the simplest approach.

  • Install R as the default Administrator account (if it is enabled and you have access to it). Note that you will also need to install packages as the Administrator user.

For a full explanation, see http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Does-R-run-under-Windows-Vista_003f.

Currently, CRAN only releases 32-bit builds of R for Microsoft Windows. These are tested on 64-bit versions of Windows and should run correctly.

Mac OS X

The current version of R runs on both PowerPC- and Intel-based Mac systems running Mac OS X 10.4.4 (Tiger) and higher. If you’re using an older operating system, or an older computer, you can find older versions on the website that may work better with your system.

You’ll find three different R installers for Mac OS X: a three-way universal binary for Mac OS X 10.5 (Leopard) and higher, a legacy universal binary for Mac OS X 10.4.4 and higher with supplemental tools, and a legacy universal binary for Mac OS X 10.4.4 and higher without supplemental tools. See the CRAN download site for more details on the differences between these versions.

As with most applications, you’ll need to have the appropriate permissions on your computer to install R. If you’re using your personal computer, you’re probably OK: you just need to remember your password. If you’re using a computer managed by someone else, you may need that person’s help to install R.

The universal binary of R is made available as an installer package; simply download the file and double-click the package to install the application. The legacy R installers are packaged on a disk image file (like most Mac OS X applications). After you download the disk image, double-click it to open it in the finder (if it does not automatically open). Open the volume and double-click the R.mpkg icon to launch the installer. Follow the directions in the installer, and you should have a working copy of R on your computer.

Linux and Unix Systems

Before you start, make sure that you know the system’s root password or have sudo privileges on the system you’re using. If you don’t, you’ll need to get help from the system administrator to install R.

Installation using package management systems

On a Linux system, the easiest way to install R is to use a package management system. These systems automate the installation process: they fetch the R binaries (or sources), get any other software that’s needed to run R, and even make upgrading to the latest version easy.

For example, on Red Hat (or Fedora), you can use Yum (which stands for “Yellow Dog Updater, Modified”) to automate the installation. On an x86 Linux platform, open a terminal window and type:

sudo yum install R.i386

You’ll be prompted for your password, and if you have sudo privileges, R should be installed on your system. Later, you can update R by typing:

sudo yum update R.i386

And, if there is new version available, your R installation will be upgraded to the latest version.

If you’re using another Unix system, you may also be able to install R. (For example, R is available through the FreeBSD Ports system at http://www.freebsd.org/cgi/cvsweb.cgi/ports/math/R/.) I haven’t tried these versions but have no reason to think they don’t work correctly. See the documentation for your system for more information about how to install software.

Installing R from downloaded files

If you’d like, you can manually download R and install it later. Currently, there are precompiled R packages for several flavors of Linux, including Red Hat, Debian, Ubuntu, and SUSE. Precompiled binaries are also available for Solaris.

On Red Hat–style systems, you can install these packages through the Red Hat Package Manager (RPM). For example, suppose that you downloaded the file R-2.8.0-2.fc10.i386.rpm to the directory ~/Downloads. Then you could install it with a command like:

rpm -i ~/Downloads/R-2.8.0-2.fc10.i386.rpm

For more information on using RPM, or other package management systems, see your user documentation.

Get R in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.