haotu : an open lab notebook


Build R package on Windows 7 64bit machine

Filed under: Microsoft Products, R — S @ 18:36

I basically followed the instructions found here: http://www.biostat.wisc.edu/~kbroman/Rintro/Rwinpack.html I had already installed MiKTex http://www.miktex.org/

1. Go to the webpage http://www.murdoch-sutherland.com/Rtools/ and Download and install the Rtools.exe file.

2. Add the Rtools directories to your PATH.

  1. Go to “Control Panel -> System.”
  2. Click on the tab “Advanced” and then on “Environment Variables.”
  3. Highlight “Path” at the bottom and click “Edit“.
  4. In the character string in “Variable Value“, I pasted C:\Rtools\bin;C:\Rtools\perl\bin;C:\Rtools\MinGW\bin;C:\R\bin; before the other directories already in the path.

3. Then download the newest version of the R batch files http://cran.r-project.org/contrib/extra/batchfiles/ and extract it to a directory. I extracted it to the directory C:\Rbatch. I found out about these batch files here: https://stat.ethz.ch/pipermail/r-help/2006-January/085819.html

4. Like for step #2, put the directory in which you extracted the batch files into your PATH. For me, I pasted C:\Rbatch; after the Rtools directories I pasted in the PATH in step #2.

5. Restart your computer.

To Build the package

6. Run the command prompt as an administrator. Right click on the command prompt icon in the Start menu and click the “run as an Administrator” option.

7. Then type R just to see if R starts running in the command prompt. Quit R if it works and if not…

8. Then in the command prompt navigate one directory up from where your package folder resides. For me I am building and installing the picante package and it can be found here on my computer: C:\Users\Public\Documents\Matt\Software\picante

9. Within the folder picante there is a directory called pkg. This directory houses all of the code, help files, and instructions for Rtools to build the R package picante. Your directory names are likely different.

10. In the command prompt type R CMD build pkg. This should build your package and you can tell if there are any errors from the output in the command window. If everything looks good, then move on to the next step, if not then try to figure out what went wrong using the output given in the command window.

11. Now type R CMD INSTALL pkg. Again there will be output to tell you if it worked or not. For me the build was successful for the 32bit version of R but not the 64bit version… I do not know why. If the same thing happens to you, please leave a comment.

12. Now open R and load the library you just built.


Blog at WordPress.com.