[R] The steps of building library in R 2.1.1

Duncan Murdoch murdoch at stats.uwo.ca
Mon Jul 25 01:15:08 CEST 2005


J. Hosking wrote:
> 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. 

Thanks.  I'll see about putting something like this into R-ext.  (I'll 
probably not put the details about installing the tools there; it's bad 
to have installation instructions in more than one place.  But the idea 
of giving a sample install seems good.)  Not sure if this will happen 
before 2.2.0; I've got a number of higher priority things to get through 
first.  But if someone wants to volunteer to write it up in texinfo 
format, I'll be appreciative.

Duncan


  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:
> 
> - you have read:
>     "Writing R Extensions" manual
>     http://www.murdoch-sutherland.com/Rtools/
> 
> - you have downloaded and installed the tools from
>    http://www.murdoch-sutherland.com/Rtools/tools.zip.
> 
> - you have installed LaTeX (fptex or MiKTeX), perl, the Microsoft help
>    compiler, and (if the package contains C or Fortran source code) the
>    MinGW compilers, as described at 
> http://www.murdoch-sutherland.com/Rtools/.
>      (MiKTeX requires some additional setup, described at
>    http://www.murdoch-sutherland.com/Rtools/miktex.html).
> 
> - your path contains the tools, htmlhelp, and the bin directories for R,
>    LaTeX, Perl, and (if the package contains C or Fortran source code
>    to be compiled with MinGW) MinGW.  The tools directory should be the
>    first item in the path.
> 
> 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:
> 
>          library(mypackage)
>          ... 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
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list