[R] make R package for windows on Linux

Liaw, Andy andy_liaw at merck.com
Wed Jan 5 15:52:12 CET 2005


> From: Marc Schwartz
> 
> On Wed, 2005-01-05 at 09:34 +0000, Halldor Björnsson wrote:
> > Hi,
> > I made a package on a linux box. All worked fine.
> > The package contains only R code (no C). I then wanted to 
> make a zip 
> > file so that I could test the package on a windows machine. 
> I have tried 
> > all the obvious ways to do this (and even some that are 
> not!), but to no 
> > avail. The only  instructions I find about building 
> packages for windows 
> > (e.g. mypkg.zip) seem to imply that the build be done on a 
> windows machine.
> > 
> > Is there a simple way to make mypkg.zip under linux and 
> then install it 
> > as a zip file on a windows machine?
> > 
> > Sincerely,
> > Halldor
> 
> 
> I have not used it, but there is an article in the Contributed
> Documentation section on the main R web site by Jun Yan and 
> Tony Rossini
> called "Building Microsoft Windows Versions of R and R packages under
> Intel Linux".
> 
> A direct link to the PDF is:
> 
> http://cran.r-project.org/doc/contrib/cross-build.pdf
>
> and there is a makefile at:
>
> http://cran.r-project.org/doc/contrib/Makefile-rcb
>
> HTH,
>
> Marc Schwartz

If the package has no compiled code, the cross-compiling setup Marc
mentioned might be an overkill.  I just tried the following with a local
package:

On Linux (SLES8 for x86_64):

  R CMD INSTALL -l localRlib mypkg_x.x-x.tar.gz
  cd localRlib
  zip -r mypkg mypkg

Now ftp the file mypkg.zip to the Windows box.  On the Windows box:

  Start up Rgui
  Use the menu Packages / Install Package(s) from Local zip file(s)
  Select the file mypkg.zip

That seems to work fine for me, with R-2.0.1 on both end.

Best,
Andy




More information about the R-help mailing list