Installing Source Packages in Windows

The packages you can download from the Packages menu in the R Windows GUI console
are binary packages: someone has previously installed a source package, zip-ed it up and pu
it on the Internet for you to download.

You will need to build a package from the sources yourself if

  • No binary for Windows is available
  • You need a later or modified version
  • It is a package you (or your supervisor) has created.

This document tells you how to do so. It is primarily aimed at people doing so on the department network, but very similar instructions will apply to your own machine.

If you have not already done so, look at Appendix E The Windows Toolset of the R Installation and Administration Manual, which you will find in HTML and PDF from the Help menu. You access to Rtools.exe (in N:\Rtools on the department systems), Perl, (in C:\Perl}.

Also, you need to create a personal library (P:\R\win-library\3.2 on the department systems) if you or R has not already done so.

Now open a Command Prompt window (via Accessories on the Start menu in Windows XP), and change to your working directory, e.g.

mkdir Rtest
cd Rtest

Now make sure R, all these tools and LATEX are in your path: on the department systems


will do so.

As an example, we will use package ald from CRAN, so download this from  and put it in the working directory (P:\Rtest in our example). You want the `Package source' link, at the time of writing

R CMD INSTALL ald_1.0.tar.gz

You may see some error messages: there will be lines starting latex: unless latex is in your
path, and possibly one
HHC6003: Error: The file Itircl.dll has not been registered correctly.
which is because HTML Help Workshop was not installed on each machine individually.

Alternatively, you can unpack the downloaded file with

tar zxvf ald_1.0.tar.gz

Rcmd INSTALL ald
installing to 'P:/R/win-library/3.2'
* installing to library 'P:/R/win-library/3.2'
* installing *source* package 'ald' ...
** package 'ald' successfully unpacked and MD5 sums checked
** R
** preparing package for lazy loading
** help
*** installing help indices
  converting help for package 'ald'
    finding HTML links ... done
    ALD                                     html
    ald-package                             html
    likALD                                  html
    mleALD                                  html
    momentsALD                              html
** building package indices
** testing if installed package can be loaded
*** arch - i386
*** arch - x64

(The output here is illustrative only.)

If that does not work, check carefully that you have sent PATH correctly.
If it does work, you can now go on to try out the packages(s) you are really interested in. You
can do quite comprehensive checks on a package by
Rcmd check mypackage

See the Writing R Extensions manual for more details.

Note that there is a security issue with using CHM help on networked drives (such as P:), and
this is disabled in the department. You can overcome this by deleting the chtml directory of
the package (here P:\R\win-library\ash\chtml), or by not creating CHM help in the first
place by

Rcmd INSTALL --docs=txt,example ash

Distributing binary packages
Once you have a package that you are happy with, you may want to distribute it to others (or even move it between the department machines and your own). To do so use
Rcmd INSTALL --build mypackage
which will produce a .zip file, e.g. This can be installed via the menu item Install package(s) from local zip files... on the Packages menu.