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



On 08.02.2012 21:05, Hadley Wickham wrote:
> 2012/2/8 Uwe Ligges<ligges at 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?
>
> We seem to be having a bit of a communication breakdown.  This is the
> code that I run from the command line (on mac os x):
>
> R_LIBS=/Users/hadley/R-dev R CMD INSTALL aL3xa-rapport-08e68ca/
> # Desktop : R_LIBS=/Users/hadley/R-dev R CMD INSTALL aL3xa-rapport-08e68ca/
> # * installing to library ?/Users/hadley/R?
> # ERROR: dependency ?ascii? is not available for package ?rapport?
>
> But:
>
> ls /Users/hadley/R-dev/
> # HandyStuff animation  biOps      mcmcTools  mvbutils   quantreg   testthat
> # SparseM    ascii      ggplot2    mturkr     nstest     scales     whisker
>
> It's hard to provide a reproducible example because it depends on
> exactly what package you have installed where, but I had hoped that
> this would at least illustrate my problem - R CMD install doesn't seem
> to be respecting R_LIBS.  I'm trying to understand whether this is a
> bug, or something I don't understand correctly about R CMD INSTALL.
>
>> 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"
>
> To clarify, system2 doesn't work in windows?

It does.

 > The system2
> documentation has: " On Windows, ?env? is currently only supported for
> commands such as ?R? and ?make? which accept environment variables on
> their command line."

Yes, but "R CMD INSTALL" does not accept those variables in the command 
line. This could perhaps be improved given someone finds some time to do it.

Uwe


>
> Hadley
>



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