Notes on R for Windows


  1. Installation
  2. Getting started
  3. Resources
  4. Start-up files
  5. Dealing with multiple projects
  6. Hints


  1. Download the file R-2.7.2-win32.exe, or the equivalent, from

  2. Run R-2.7.2-win32.exe by double-clicking on it.

  3. The installation program will create the directory c:\Program Files\R\R-2.7.2 where "R-2.7.2" may vary, according to the version of R that you have installed.

  4. The actual R program will be c:\Program Files\R\R-2.7.2\bin\Rgui.exe. A windows "shortcut" should have been created on the desktop and/or in the start menu.

[Back to top]

Getting started

  1. Start R by double-clicking on the R icon on the desktop, or by clicking on the R icon in the start menu.

    The R graphical user interface (GUI) will open, containing a single window called the command or console window.
    The greater-than sign ( > ) is R's "prompt;" it indicates that R is ready for you to enter commands.

  2. Look at some of the freely-available resources for R.

  3. Getting help within R:

    1. The html version of R's help pages are best. Within R, use the menu bar: Help:R language (html).

    2. At the command prompt, type, for example, ?read.table or help(read.table) to get help on the function read.table. If you first type options(htmlhelp=TRUE), the above commands will open the html version of the help files.

    3. At the command prompt, type, for example,"read") or apropos("read") to search for things in R related to the word "read." Alternatively, go to the menu bar: Help:Apropos

  4. You can exit R in at least three ways:

    1. Click on the X in the top-right corner of the GUI.

    2. Type q() at the command prompt.

    3. Use the menu bar: File:Exit.

    In each case, you will be asked, "Save workspace image?" Click "Yes" to save your work, "No" to discard your work, or "Cancel" to return to R.

[Back to top]


The following is a subset of the resources available for learning and using R.

  1. Comprehensive R Archive Network (CRAN)

  2. R manuals:
    1. An introduction to R
    2. R installation and administration
    3. R data import/export
    4. The R language definition

  3. Contributed documentation:
    1. SimpleR (John Verzani)
    2. Kickstarting R (Jim Lemon)
    3. Using R for data analysis and graphics (John Maindonald)

  4. Frequently asked questions:
    1. R FAQ
    2. R Windows FAQ

  5. Publications related to R:
    1. WN Venables and BD Ripley (2002) Modern applied statistics with S, 4th edition. Springer [Online complements]
    2. P Dalgaard (2008) Introductory statistics with R, 2nd edition Springer
    3. AF Zuur, EN Ieno, EHWG Meesters (2009) A beginner's guide to R, Springer
    4. MJ Crawley (2007) The R book, Wiley
    5. BS Everitt, T Hothorn (2006) A handbook of statistical analyses using R, Chapman & Hall/CRC
    6. J Maindonald, J Braun (2006) Data analysis and graphics using R, 2nd edition, Cambridge University Press
    7. J Verzani (2004) Using R for introductory statistics, Chapman & Hall/CRC

  6. R email lists

  7. R newsletter

[Back to top]

Start-up files

For the efficient use of R (on your own computer), it is useful to create a couple of start-up files, in order to set some default options or run some R commands automatically.

The file c:\.Renviron is used to set certain environment variables for R. I recommend a file containing the following line, since, by default, R assumes you want A4 paper.


The file c:\.Rprofile is assumed to contain R code, which is run at start-up. I recommend including something like the following (to make use of the html version of the help pages the default, to turn off the asterices that show up in significance tests). You may also use this to automatically load an optional package.

options(htmlhelp=TRUE, show.signif.stars=FALSE)

[Back to top]

Dealing with multiple projects

R keeps your "workspace" of objects in a single file (.RData), which is read into RAM when R is started and potentially written to disk at the end of a session. (Note: To save your workspace without exiting, type save.image() at the R prompt. It is good to do this periodically, so that your work is saved in case that R or your computer crashes.)

One may wish to have multiple R workspaces (i.e., .RData files), one for each project or data set. In Windows, we do this as follows:

  1. Create multiple folders (i.e., directories), one for each project (for example, c:\Rwork\Project1 and c:\Rwork\Project2).

  2. For each project, create a shortcut to the R GUI:

    1. Right-click on the R icon on the desktop and select Create Shortcut.
    2. Right-click on the new icon that is created and select Properties.
    3. In the properties window that is opened, modify Start in: (in the tab Shortcut) to the directory for the project (for example, c:\Rwork\Project1).
    4. Rename the shortcut to something like R Project1.

  3. When you double-click on the icon for this new shortcut, it will open R using the workspace for this project.

[Back to top]


[Back to top]

Back to home page

Last modified: Mon Jun 29 23:50:20 2009