[R] The steps of building library in R 2.1.1
Ivy_Li
Ivy_Li at smics.com
Thu Jul 21 05:25:04 CEST 2005
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 at smics.com>
Maintainer: Ivy <Ivy_Li at 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.
---------- Making package example ------------
adding build stamp to DESCRIPTION
installing R files
installing data files
installing man source files
installing indices
not zipping data
installing help
>>> Building/Updating help pages for package 'example'
Formats: text html latex example chm
d text html latex example
e text html latex example
f text html latex example
g text html latex example
adding MD5 sums
* DONE (example)
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 at smics.com
More information about the R-help
mailing list