lab:people:build_r_packages_for_windows
                Table of Contents
Build R packages
Step1: generate a skeleton
package.skeleton(name="bmem", code_files="bmem.R")
Step 2: edit DESCRIPTION file
Building R packages in Windows
Disclaimer: The instructions below describe what I've been doing to compile an R package for Windows. Check out the files “src/gnuwin32/INSTALL” and “src/gnuwin32/readme.packages” in the R source distribution for the official (and recommended) approach. Most importantly, see this page.
Also note: there is an online service (http://win-builder.r-project.org) for building and checking R packages for Windows.
Preparations
- Look at the Windows toolset appendix in the R Administration manual.
 - Go to the webpage http://www.murdoch-sutherland.com/Rtools/
 - Download and install the “Rtools.exe” file. This includes:
- A bunch of command-line tools
 - Perl
 - The MinGW compiler
 
 - You may also want:
 - Make sure your PATH contains all of the right directories (e.g., that the R bin directory is correct).
- Go to “Control Panel → System.”
 - Click on the tab “Advanced” and then on “Environment Variables.”
 - Highlight “Path” at the bottom and click “Edit”.
 - In the character string in “Variable Value”, you want “c:\Rtools\bin;c:\Rtools\perl\bin;c:\Rtools\MinGW\bin;c:\R\bin” and then any other stuff at the end. (Most problems I've experienced have been due to incorrect directories here, or an incorrect order in the directories.)
 
 
Building an R package in Windows
With the latest versions of R, this is easy. I'll use, as an example, my own package, “qtl”.
- Extract the package source to a directory, say “c:\MyRpackages\qtl”
 - Go to the directory “c:\MyRpackages”
 - Type “R CMD build –binary qtl”
 - A file like “qtl_0.98-52.zip” should be created.
 
lab/people/build_r_packages_for_windows.txt · Last modified: 2016/01/24 09:48 by 127.0.0.1
                
                