[R] The steps of building library in R 2.1.1

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Jul 21 14:57:45 CEST 2005

Ivy_Li wrote:

> 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

You are welcome.

The following is intended for the records in the archive in order to
protect readers.

> 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> 

Do you mean http://www.murdoch-sutherland.com/Rtools/ ?

> 2. Download the "rw2011.exe"; Install the newest version of R
> 3. Download the "tools.zip"; Unpack it into c:\cygwin

Not required to call it "cygwin" - also a bit misleading...

> 4. Download the "ActivePerl-"; Install Active Perl in c:\Perl

Why in C:\Perl ?

> 5. Download the "MinGW-3.1.0-1.exe"; Install the mingw32 port of gcc in c:\mingwin

Why 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.

OK, this (1-6) is all described in the R Administration and Installation
manual, hence I do not see why we have to repeat it here.

> 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. 

This is described in Writing R Extension and is not related to the setup
of you system in 1-6.

> 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

This is described in the R Administration and Installation manual
and I do not see why we should put the html compiler to the other tools.

> 9. In the DOS environment. Into the "D:\>"  Type the following code: 

There is no DOS environment in Windows NT based operating systems.

> 	cd \Program Files\R\rw2010 
> 	bin\R CMD INSTALL "/Program Files/R/rw2011/example"

I do not see why anybody would like to contaminate the binary
installation of R with some development source packages.
I'd rather use a separate directory.

I think reading the two mentioned manuals shoul be sufficient. You have
not added relevant information. By adding irrelevant information and
omitting some relevant information, I guess we got something that is
misleading if the reader does NOT read the manuals as well.

Uwe Ligges

> 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
> ------------------------------------------------------------------------
> ______________________________________________
> R-help at 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

More information about the R-help mailing list