Re: [R] The steps of building library in R 2.1.1

From: J. Hosking <>
Date: Mon 25 Jul 2005 - 07:02:32 EST

Duncan Murdoch wrote:

> Could you point out the specific bits that are missing from the R-Admin
> manual (and perhaps supply them)? It won't get better unless someone
> improves it.

R-admin is fine. The problem is in "Writing R extensions", which would benefit from containing an explicit recipe for constructing an R package, and in particular for constructing an R package under Windows in both source and binary versions. Several such recipes have been posted to the internet or R-help. The one that I have found to be the most useful was posted to R-help by Gabor Grothendieck on 2 March 2005. I am appending it below, with some trivial modifications of my own. I think it would be very useful if this information were included in the R-exts manual, perhaps at the end of the "Creating R packages" section.

J. R. M. Hosking

Making a package under Windows

Make sure that:

Assuming that the R installation is in \Program Files\R\rw....

  1. Assuming your source package tree is in \Rpkgs\mypackage then at a Windows command prompt:
         cd \Rpkgs
         Rcmd install mypackage

    which will install it to \Program Files\R\rw....\library\mypackage.     Or if you want to install it to a separate library:

         cd \Rpkgs
         md library
         Rcmd install -l library mypackage

2. Now in R:

         ... test it out ...

    or if you installed it to a separate library:

         library(mypackage, lib.loc = "/Rpkgs/library")

3. Once it seems reasonably OK, see whether it passes Rcmd check:

         cd \Rpkgs
         Rcmd check mypackage

    and fix it up until it does.

4. Now create versions for Unix and Windows that you can distribute:

         cd \Rpkgs
         Rcmd build mypackage
         Rcmd build mypackage --binary

______________________________________________ mailing list PLEASE do read the posting guide! Received on Mon Jul 25 07:17:53 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:34:00 EST