From ligges at statistik.tu-dortmund.de  Wed Feb  8 20:05:08 2012
From: ligges at statistik.tu-dortmund.de (Uwe Ligges)
Date: Wed, 08 Feb 2012 20:05:08 +0100
Subject: [Rd] Using custom R_LIBS with R CMD install
In-Reply-To: <CABdHhvFdJsRDz3xehivG2vm+0Z=wVtm4gviNp9yh5RLex24WNg@mail.gmail.com>
References: <CABdHhvELJ6SDQ0qSfGrxn-Rju1-=8Vr0=1QQ6bvQKxgHQZ_JQw@mail.gmail.com>
	<4F32BE3C.8050304@statistik.tu-dortmund.de>
	<CABdHhvFdJsRDz3xehivG2vm+0Z=wVtm4gviNp9yh5RLex24WNg@mail.gmail.com>
Message-ID: <4F32C764.1070400@statistik.tu-dortmund.de>



On 08.02.2012 19:36, Hadley Wickham wrote:
>> I wonder it works that far. It won't for me on Windows nor Linux, because
>> system2 passes the whole thing shQuoted to the shell. Hence it is highly
>> shell dependent what happens with the ill formed command.
>
> Well I was using the env argument to system2, which claims to be
> cross-platform (at least for R and make).  This command:
>
> R_LIBS=/Users/hadley/R-dev R CMD INSTALL aL3xa-rapport-08e68ca/
>
> is ok, isn't it?

You haven't said you were using the env argument, have you? If so, I 
missed that part. I assumed you were specifying the above as the 
"command" argument.

Hmmm, former message not quoted, as we ask in the posting guide. Where 
is the reproducible example?

Anyway, this won't work under a Windows shell, I believe. At least, I do 
not know how to set an env variable and run RCMD INSTALL in a Windows 
shell as a one liner - independent of R.


>> Whay not specify --library= in R CMD INSTALL if you are calling it
>> programatically from R anyway?
>
> My understanding (from reading R CMD INSTALL --help) was that
> --library was for specifying the destination library.  Here I want to
> specify the full libpath - i.e. some of the packages that this package
> depends on may be in library 1, others may be in library 2.  Have I
> misunderstood the documentation?

That's right, then you want (under Linux alikes):

system2("R", "CMD INSTALL package_version.tar.gz", env="R_LIBS=lib")

obviously.

Under Windows, you have to construct the shell command:

"set R_LIBS=lib & R CMD INSTALL package_version.tar.gz"

Uwe







>
> Hadley
>



[Rd] Using custom R_LIBS with R CMD install
Uwe Ligges