Re: 答复: [R] fail in adding library in new version.

From: Gabor Grothendieck <>
Date: Thu 30 Jun 2005 - 21:16:07 EST

On 6/30/05, Ivy_Li <> wrote:
> Dear Gabor,
> Thank your for helping me so much!
> I have loaded R the newest version 2.1.1. Then I setup it in the path of D:\program files\R\
> 1. unpack into c:\cygwin
> 2. install Active perl in c:\Perl
> 3. install the mingw32 in c:\mingwin
> 4. add "c:\cygwin; c:\mingwin\bin" in "Control Panel -> System -> Advanced -> Environment Variables -> Path -> Variable" (In your previous mail, you said "put these at the beginning of the path", I don't understand what is your meaning. Which path?)

If in the console you enter the command:


then it will display a semicolon separated list of folders. You 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.

> 5. I tried an library example. I set a new folder named "example" in the "c:\MyRpackages\". And In the "example" folder, it contain an "DESCRIPTION" file and "R" folder. in "R" folder contain a "example" file. I just write very simple script in it:
> a<-2; b<-3;sum <- sum(a,b); print(paste(a,"+",b,"=",sum))
> 6. I opened the DOS environment. Into the "D:\>" Type the following code:
> cd \Program Files\R\rw2010
> But I don't understand the second line you writed in your previous mail: "bin\R cmd install /MyRPackages/example"

I was assuming that MyRPackages and R are on the same disk. If they are not then you need to specify the disk too. That is if MyRPackages is on C and R is installed on D then install your package via:

cd \Program Files\R\rw2010
bin\R CMD install c:/MyRPackages/example

Note that bin\R means to run R.exe in the bin subfolder of the current folder using command script install and the indicated source package.

> I am not sure that I set up R in "D:\" But I do so much action in C:\ Did I do the correct action? Did I do the action into the correct path?

If you are not sure where R is installed then enter the following at the Windows console prompt to find out (this will work provided you let it install the key into the registry when you installed R initially). The reg command is a command built into Windows (I used XP but I assume its the same on other versions) that will query the Windows registry:

reg query hklm\software\r-core\r /v InstallPath

> I still need your and others help. Thank you very much!
> -----原始邮件-----
> 发件人: Gabor Grothendieck []
> 发送时间: 2005年6月6日 10:21
> 收件人: Ivy_Li
> 抄送:
> 主题: Re: [R] fail in adding library in new version.
> On 6/5/05, Ivy_Li <> wrote:
> > Hello everybody,
> > Could I consult you a question?
> > I always use R old version 1.9.1 . Because I can not add my library into the new version 2.0.0 by the same method as old version.
> Getting the latest version of R is strongly recommended. The suggestions
> below all assume the latest version and may or may not work if you do
> not upgrade.
> > * I have read the webpage <>
> > * Download the
> > * Unpack into c:\cygwin
> > * Install Active Perl in c:\Perl
> > * Install the mingw32 port of gcc in c:\mingwin
> > * Then go to "Control Panel -> System -> Advanced -> Environment Variables -> Path -> Variable Balue" add ;c:\cygwin;c:\mingwin\bin
> You may need to put these at the beginning of the path rather than the end.
> Also just as a check enter
> path
> at the console to make sure that you have them. You will likely
> have to start a new console session and possibly even reboot.
> Also you need the Microsoft Help Compiler, hhc. Suggest
> you reread the material on which tools you need.
> > * Save my library "example" into "c:\MyRpackages\" . But I am not sure what type it is, is it need suffix?" And I don't what its content, just my function script, no special format?
> In MyRPackages you would have a folder called example, in your case,
> that contains the package. Within folder example, you would have the
> DESCRIPTION file, the R folder, etc.
> > * Then I don't know where should I do this step: Type R CMD INSTALL --build example. Need I run R first?
> You don't have to run R first. You do need to make sure that R.exe can
> be found on your path or else use the absolute path name in referring to R.
> For example, if your path does not include R you could do something like this:
> cd \Program Files\R\rw2010
> bin\R cmd install /MyRPackages/example

Sorry, there is an error in the above. It should be:

bin\R CMD install c:/MyRPackages/example


bin\Rcmd install c:/MyRPackages/example

> Be sure to use forward slashes where shown above and backslashes
> where shown.
> > So There is a error after I do this step. It said it can not find somethig. I don't which step is wrong. It costed me much time.
> >
> Try all these suggestions including upgrading R and if that does not work
> try posting screen dumps of the actual errors you are getting.

Also try googling for

  making creating R packages

and you will find some privately written tutorials on all this. mailing list PLEASE do read the posting guide! Received on Thu Jun 30 21:18:55 2005

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