[R] writing a simple package in R 2.0 under Windows XP

Gabor Grothendieck ggrothendieck at myway.com
Sun Nov 7 16:56:58 CET 2004

John Fox <jfox <at> mcmaster.ca> writes:

> Building Simple Packages Under R for Windows
> 2. Make sure R is *not* installed under c:\Program Files (or in any location
> with spaces in the path) and that it is installed with package-building
> tools. I use c:\R for the installation; I'll assume this below -- make
> changes as necessary. 

I just have been through building packages with XP this weekend.
I used the default R installation which installs R 2.0.1 beta under 

   C:\Program Files\R\rw2001beta

and had no problems with using that pathname so I believe this warning 
is no longer needed, at least with XP and R 2.0.1.  That would 
slightly simplify installation since it allows one to use the 
default installation.

Uwe pointed out to me that one should use forward slashes rather
than backward slashes on path names when using R CMD ... .
I think you have avoided the need for pathnames in your script
altogether but thought I would mention it since it was a significant 
gotcha for me.

> 5. Download fptex from
> <http://www.ctan.org/tex-archive/systems/win32/fptex/current/TeXSetup.exe>
> and install it. Note: This requires a fast internet connection during the
> installation. Don't install latex under c:\Program Files\!

I used MiKTeX which is a pain since there is some configuration
to be done to use it with R although it works well once MiKTeX 
is so configured.  The murdoch link you posted describes the 
configuration steps.  Someone else also 
mentioned to me privately I should have tried fptex and would
have avoided these configuration problems.  (It occurred to me
that if the Rd.sty file could be added to the MiKTeX repository
online where MiKTeX gets its other .sty files then it could be 
pulled out from there and the MiKTeX configuration would not have 
to be modified to access the R directory tree.)

> ..\..\bin\R CMD build --force --binary --auto-zip %1
> ..\..\bin\R CMD build --force %1
> ..\..\bin\R CMD check %1

It was also pointed out to me that --force
is an important switch; however, I did not use it and did
not notice any problems.  I also did not use --auto-zip.
Any comments on the importance of these?

Andy advised me to first use:

   R CMD install ...

to get my software going and that advice seemed particularly useful 
since it allowed me to install, run and test my software as a package 
in R so that I could get it in better shape before submitting it to 
R CMD check ... and R CMD build ... --binary .

More information about the R-help mailing list