The Windows distribution of R, which runs under Windows
95 and more recent versions of Windows, is available as
a standard Windows installer, called R-2.5.1-win32.exe
This version includes the basic R system, several recommended packages,
the R manuals, help files in several forms, a basic Tcl/TK installation
(for graphical user interfaces), and software that you will need if you
want to write your own R packages.R-2.5.1-win32.exe
is fairly small in comparison to typically bloated Windows software, but
it is still a large file (29 Mbytes) to download over a slow
connection to the Internet.
For use in a class, the instructor can prepare a CD-ROM with R-2.5.1-win32.exe
and other R files (such as the pre-compiled contributed packages); it is
even possible to prepare a Windows installer for customized versions of
After downloading R-2.5.1-win32.exe
or otherwise acquiring a copy of this file, you may run the installer in
the normal manner, for example, by double-clicking on the R-2.5.1-win32.exe
file in the Windows Explorer. During the installation, most users may safely select
all of the defaults (simply clicking the Next
on each screen). There are potential installation issues for users of
Windows Vista due to the security provisions in that OS; Windows
Vista users should consult the relevant section of the R for Windows FAQ
Step 2: Download and install additional R packages
If you have installed R as described in Step 1, there will be an R icon
on your desktop. Run R by double-clicking this icon (or from the Start
R comes with several useful contributed packages. To see them, enter the
in the R Console
. In addition, you will
want to install the car
package associated with the R and S-PLUS
, and possibly other packages as well.
The easiest way to install additional packages (such as the car
package) is from the Packages
menu in R:
- Run R, if it is not already running.
- Select Packages
Install package(s) from CRAN ... . A window will open asking you
to pick a CRAN mirror site for your session; following this, a window
will open with the various packages that are available on CRAN.
- Using the mouse, select the package or packages that you want to install;
if you want to install more than one package, hold down the Control
key while you click on the additional packages.
- When you are finished selecting packages, click the OK button.
You can also install binary packages from another source, such as a CD-ROM:
- Select Install package(s) from local zip files ... from the
Packages menu in R.
- Navigate to the location of the zip file containing the package.
- Click the Open button.
Even if you have installed R from a CD-ROM, however, you are probably better
off installing packages directly from CRAN (as long as you have an Internet
connection): Package files are not very large, and installing from CRAN
insures that you get the latest version.
Note, as well, that you can periodically update all
of your installed
packages to the latest version by selecting Update packages from CRAN
from the Packages
menu in R. Only newer versions of packages than
those currently installed on your system will be downloaded and installed.
It is a good idea to do this periodically, including in a newly installed
version of R, since some of the recommended packages bundled with the R
distribution may have been updated since R-2.5.1-win32.exe
Note for Windows Vista users: If you have installed R into the default location in C:\Program Files\
then you will have trouble installing packages unless you use the
default Administrator account. See the relevant section of the R for Windows FAQ
Step 3: Optionally Customize R
R is highly configurable. If you have installed R on a single-user Windows
system, I suggest that you customize R by editing the configuration files,
which are located in the etc
subdirectory off the main R directory.
These are plain-text (ascii) files, which should be edited with a text editor
such as Windows Notepad. Before editing a configuration file it is a good
idea to make a copy of it, attaching the file-type .dist
copy; then, if you hopelessly mess up a file, you can easily return to the
You will find the following configuration files :
- Rconsole, logically enough, contains settings, such as colors
and fonts, for the R Console. You probably will not want to change these
- Rdevga contains font selections for graphics windows. Again,
you probably will not want to alter the font selections.
- rgb.txt contains named red-green-blue color definitions.
You can alter the standard definitions or add your own, but there is
probably no reason to do so.
- Rprofile.site contains R commands to be executed at the start
of each session, such as options(show.signif.stars=FALSE).
Place the commands on separate lines in Rprofile.site . Remember
to save the file after you have finished editing it. (Note that prior
to R 2.2.0, this file was called Rprofile
in the Windows version of R.)
The standard R installation is configured reasonably, but there are
a few things that you may wish to change:
- I suggest that you use a programming editor with R, as described in
Chapter 1 of the R and S-PLUS Companion. The current version
of R for Windows includes a basic "script" editor (you can
open a script window via the File menu), but a good programming
editor provides additional features such as syntax highlighting and
- Uwe Ligges has contributed
special configuration files and
instructions for using the WinEdt
editor with R. Note that WinEdt is shareware, not free software.
- Alternatively, you may wish to try the free "Emacs speaks statistics"
(ESS); I have prepared detailed information about installing,
configuring, and using ESS with the Windows version of XEmacs.
Note: Because of the availability of the Tinn-R editor (immediately
below), I am no longer maintaining this information about ESS, and it
may be out of date.
- Finally, José Cláudio Faria has made available a
very nice, free Windows programming editor for R called Tinn-R;
I believe that this is currently the best choice for most Windows users
of R. To use Tinn-R, you have to run R for Windows in "single-document
interface" (SDI) mode, in which different R windows are independent
rather than being contained in a master window as in the default
"multiple-document interface" (MDI). You can select the SDI during the
installation process or edit the Rconsole file afterwards (see below).
- As described in Chapter 1 of the R and S-PLUS Companion, it is desirable
to keep saved workspaces for different projects in separate directories.
This assumes, of course, that you choose to save the R workspace; I
believe that most users are well advised to start each R session with
a fresh workspace, and therefore should not save the workspace between
sessions. A simple way to save project-specific workspaces is to create
a menu-item to be used with the context menu for the right mouse button
in Windows Explorer:
Once you have completed this procedure, you can run R in a particular
directory by right-clicking on the directory in Windows Explorer and selecting
Run R from the context menu. Then, when you save the workspace,
it will be saved in this directory. (RunRHere is taken from a suggestion
posted by Dieter Menne to the R-help email list.)
- Download the file RunRHere.reg
to your hard disk.
- Using a plain-text (ascii) editor, edit RunRHere.reg
to reflect the location of the file Rgui.exe on your system.
- In the Windows Explorer, double-click on the file RunRHere.reg
. WARNING: This procedure makes
a change to your Windows registry, which is inherently risky. Make
sure that your system is backed up, and that the contents of RunRHere.reg
are correct before proceding. If this makes you nervous, don't
- An alternative to the preceding approach is to create an icon on the
Windows desktop for each project:
- Right-click on the current R icon on the desktop, and (holding down
the right mouse button) drag the icon to another location on the desktop.
Release the mouse button and select Copy Here from the context
- Alternatively, in Windows Explorer, navigate to the bin
subdirectory under the main R directory; right-click on Rgui.exe
, and drag this file to the desktop; select Create Shortcut(s)
Here from the context menu.
- Right-click on the newly created icon. Select Properties
from the pop-up menu. Edit the Start in field on the Shortcut
tab so that it contains the directory for the project. Edit the
name field on the General tab to contain the name that you
want to assign to the project. Click OK when you are finished.