[R] Building R packages under Windows.

Gabor Grothendieck ggrothendieck at gmail.com
Mon Apr 11 14:15:07 CEST 2005


On Apr 11, 2005 2:58 AM, Duncan Golicher <dgoliche at sclc.ecosur.mx> wrote:
> Hello,
> 
> My question is the following. Has anyone put together an "idiots"
> checklist of the steps needed to build a (small personal) package under
> Windows, or documented their own experiences of building packages under
> Windows?
> 
> I ask this as last week there were some very interesting comments
> regarding the advantages of putting personally written functions
> together as a package rather than sourcing them in at the start of a
> session using .Rprofile. They inspired me to try to build my own package
> for a few functions I use in teaching on my laptop running Windows XP .
> I read and reread "Writing R extensions" I  installed Pearl and tried
> build on a modified package.skeleton. I fairly quickly worked out I
> needed to do things like setting Tmpdir as an environment variable, but
> then I got stuck and frustrated and gave up. I'm sure that with more
> time I would get things working, but I don't have more time. Could the
> process be made smoother through better documentation? This may sound
> like laziness, but I do guess that there are others are in the same
> position who find that the initiial hassles of building a package (under
> Windows) leads to a negative cost benefit balance over less elegant
> solutions.
> 
> Thanks,

Other resources are:
- http://www.murdoch-sutherland.com/Rtools/
- README.packages in \Program Files\R\rw2001 or whatever version of R
- posts by me, John Fox, Andy Liao in r-help or r-devel

I use Windows XP and it also took me quite a bit of time until I 
figured it out too.  I was really wondering as I got frustrated how
it was possible that 500+ packages got developed for R when it
was so hard to figure out how to create a package, particularly
if you want to put in a vignette.  One of the problems is that its
dependent on so many other pieces of software and also there can
be path problems that you have to figure out.  I suspect that the process
is somewhat smoother under UNIX and maybe most people use
that.  

Fortunately, it does all work once you get it figured out
and its worth it if you are going to do a lot of development since
it really helps organize you.   If you are just going to use it briefly
or casually its probably not worth the hassle.  Once you do figure
it out it does work although there are a few annoyances.
R CMD CHECK is really great although I wish there were some 
way of telling it to ignore the files referenced in .Rbuildignore so 
one does not have to do a build first.  Also the error messages
from the process are often less than helpful but I suspect it would
be difficult to improve since it can go wrong at a point which is
different than the source of the problem.

I think the fixable problems are:
- a guide is needed, as you mention
- the prerequisites need to be reduced:
  -- significant portions are written in perl which is probably a 
     holdover from the days when R was less powerful and now
     could all be ported to R
  -- it would be nice it the tools were not needed either.  
  -- reduced functionality with no Microsoft style help should be
     possible to optionally allow one to create packages without
     downloading the Microsoft help compiler
- the TEXINPUTS problems with MiKTeX needs to be solved
  by MiKTeX (they know about it and intend to solve it but I am
  not sure how quickly that will happen.  In the meantime there
  are workarounds at:
     http://www.murdoch-sutherland.com/Rtools/miktex.html
  The fourth alternative is the easiest.  I think this only affects
  you if you are building vignettes.)




More information about the R-help mailing list