Installing R on a USB drive

Here are detailed instructions for installing and running R from a USB drive; these instructions are not for installing R on a hard drive.

These instructions have been written for Windows XP systems as of January, 2009 with R version 2.8.1. Instructions also seem to work for Vista system, but have been tested only when logged in as administrator. In Vista the Windows XP "My Computer" became "Computer" on the Start Menu.

Step 1: Install R.

  1. Go to: R project home page
  2. Click on CRAN (at left, under "Download").
  3. Select a CRAN mirror site.
  4. Under "Download and Install" Precompiled binary distributions ...
    click on Windows.
  5. On the next page "R for Windows", click on base.
  6. On the next page download R-2.8.1-win32.exe Setup program (or the current version).
  7. Run the setup program.
    1. At the step "Select destination location" click Browse and navigate to the USB drive to the location where R should be installed.
      e.g. G:\R-2.8.1 if we are installing it in the root directory of removable drive G.
    2. At the step "Select components" check all on-line PDF manuals
      (recommended if you have space; if space is limited, omit the reference manual.)
    3. "Startup options" click "Yes" for customized startup options.
    4. "Help style" choose the way you prefer to see help pages displayed. The familiar Windows style help is called CHM style.
    5. "Select Start Menu Folder" - check "Don't create a Start Menu folder"
    6. "Select Additional Tasks" - uncheck all tasks
      (you will create a shortcut to R below.)
    7. Wait ... while the setup program installs all of the files.
Step 2: Create a working directory on USB drive for user files.
  1. Open "My Computer" and navigate to the USB drive.
  2. File > New > Folder [or in Vista use Organize>New Folder].
  3. Give the working folder a name, say "Rfiles" (you choose the name).
Step 3: Create a shortcut to R (Rgui.exe) on USB drive.
  1. Open "My Computer" and navigate to the USB drive location where you would like the shortcut.
  2. In empty part of window right-click and select New>Shortcut.
  3. In "Create Shortcut" browse to Rgui (Rgui.exe) program. Rgui is located in the bin subdirectory.
    For example, if we installed R in "G:\R-2.8.1" then we need to browse to or type "G:\R-2.8.1\bin\Rgui.exe"
    Click "Next"
  4. Type a different name for this shortcut if you prefer. Click "Finish"
  5. Find the new shortcut, right click on it. Select "Properties".
  6. Under "Start in" enter the full path to the working directory created in Step 2. An example is shown below.


After completing the steps above, in Windows XP your USB drive might look similar to the following.

USB contents

Step 4: Test installation by double clicking on USB shortcut to R.
In above picture you would double click on "Rgui.exe".

Step 5: Run "Update Packages" from the R "Packages" menu.

NOTE: You will not start R from the Start Menu in Windows.
Insert the USB drive into the computer and double click on the shortcut that you created on the USB drive.