[R] The steps of building library in R 2.1.1

From: Ivy_Li <Ivy_Li_at_smics.com>
Date: Thu 21 Jul 2005 - 13:25:04 EST


Dear All,

With the warm support of every R expert, I have built my R library successfully. Especially thanks: Duncan Murdoch

		    Gabor Grothendieck   
		    Henrik Bengtsson
		    Uwe Ligges

Without your help, I will lower efficiency. I noticed that some other friends were puzzled by the method of building library. Now, I organize a document about it. Hoping it can help more friends.
  1. Read the webpage <http://www.stats.ox.ac.uk/pub/Rtools>
  2. Download the "rw2011.exe"; Install the newest version of R
  3. Download the "tools.zip"; Unpack it into c:\cygwin
  4. Download the "ActivePerl-5.6.1.633-MSWin32-x86.msi"; Install Active Perl in c:\Perl
  5. Download the "MinGW-3.1.0-1.exe"; Install the mingw32 port of gcc in c:\mingwin
  6. Then go to "Control Panel -> System -> Advanced -> Environment Variables -> Path -> Variable Balue"; add "c:\cygwin;c:\mingwin\bin" The PATH variable already contains a couple of paths, add the two given above in front of all others, separated by ";". Why we add them in the beginning of the path? Because we want the folder that contains the tools to be at the beginning so that you eliminate the possibility of finding a different program of the same name first in a folder that comes prior to the one where the tools are stored.
  7. I use the package.skeleton() function to make a draft package. It will automate some of the setup for a new source package. It creates directories, saves functions and data to appropriate places, and creates skeleton help files and 'README' files describing further steps in packaging. I type in R:
    >f <- function(x,y) x+y
    >g <- function(x,y) x-y
    >d <- data.frame(a=1, b=2)
    >e <- rnorm(1000)
    >package.skeleton(list=c("f","g","d","e"), name="example")
    Then modify the 'DESCRIPTION': Package: example Version: 1.0-1 Date: 2005-07-09 Title: My first function Author: Ivy <Ivy_Li@smics.com> Maintainer: Ivy <Ivy_Li@smics.com> Description: simple sum and subtract License: GPL version 2 or later Depends: R (>= 1.9), stats, graphics, utils You can refer to the web page: http://cran.r-project.org/src/contrib/Descriptions/ There are larger source of examples. And you can read the part of 'Creating R Packages' in 'Writing R Extension'. It introduces some useful things for your reference.
  8. Download hhc.exe Microsoft help compiler from somewhere. And save it somewhere in your path. I download a 'htmlhelp.exe' and setup. saved the hhc.exe into the 'C:\cygwin\bin' because this path has been writen in my PATH Variable Balue. However if you decided not to use the Help Compiler (hhc), then you need to modify the MkRules file in RHOME/src/gnuwin32 to tell it not to try to build that kind of help file
  9. In the DOS environment. Into the "D:\>" Type the following code: cd \Program Files\R\rw2010 bin\R CMD INSTALL "/Program Files/R/rw2011/example" Firstly, because I install the new version R in the D:\Program Files\. So I should first into the D drive. Secondly, because I use the package.skeleton() function to build 'example' package in the path of D:\Program Files\R\rw2011\ So I must tell R the path where saved the 'example' package. So I write the code is like that. If your path is different from me, you should modify part of these code.

10.Finally, this package is successfully built up.

I was very happy to get the great results. I hope the document can help you. Thank you again for everyone's support.

Best Regards!
Ivy Li衣
YMS in Production & Testing
Semiconductor Manufactory International(ShangHai) Corporation #18 ZhangJiang Road, PuDong New Area, Shanghai, China Tel: 021-5080-2000 *11754
Email: Ivy_Li@smics.com



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jul 21 13:34:08 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:53 EST