Creating a personal library for R packages - Windoze XP.

The procedure for Windows is similar, but setting the environment variable depends on which version of Windows you are running. Here are the instructions for Windows XP. This is an expanded version of this document for Windows 7
  1. Navigate to your My Documents folder (or anywhere else you want to keep the library).
  2. Create a new directory (folder) for the R pacakges. Traditionally this is called Rlibs


  3. You now want to create an environment variable called R_LIBS that points to this directory.
  4. Right-click My Computer, and then click Properties.

  5. Click the Advanced tab.
  6. Click Environment variables.

  7. Click New to add a new variable name and value.

  8. In the "Variable name" field, type in all caps: R_LIBS
    In the "Variable value" field, type: C:\Documents and Settings\cschwarz\My Documents\Rlibs (or whatever you called the package directory in step 1). The name may force the string to scroll to the left if it can't fit in the window.

  9. Click OK and verify that you can see the Variable/Value pair listed under the "User variables for ..." section.

  10. Click OK again and again until you are completely backed out.
  11. Start R and type in the command ".libPaths()" without the quotes.
    You should see an entry for C:\Documents and Settings\cschwarz\My Documents (or whatever you chose in step 1). If you do not see this, then you have skipped one of the above steps. Do not proceed until .libPaths() reports correctly.


    [ SFU Statistics and Actuarial Science Home | SFU Home]
    Email comments or suggestions to Carl Schwarz (cschwarz@stat.sfu.ca)
    © 2013 Carl James Schwarz Last updated 2013-10-18.