[Rd] Ignoring .Rprofile when installing a package

Keith keith at wehi.EDU.AU
Mon Feb 21 01:25:44 CET 2011


Jon,

I have had a similar problem when installing librarys. I have written a 
script which uses biocLite to install librarys.
I have included the following code which hides .Rprofile by renaming it 
and then renaming it back again after it has finished.

#Hide .Rprofile whilst this script is running.
file.rename(paste(Sys.getenv("HOME"),".Rprofile",sep=.Platform$file.sep),paste(Sys.getenv("HOME"),".Rprofile_hiding",sep=.Platform$file.sep))
# ...
# ... install libraries code
# ...
#Put .Rprofile back
file.rename(paste(Sys.getenv("HOME"),".Rprofile_hiding",sep=.Platform$file.sep),paste(Sys.getenv("HOME"),".Rprofile",sep=.Platform$file.sep))

I think this should be platform independent, but have mainly tried it on 
Windows and Unix.

cheers,

Keith Satterley,


On 18/02/2011 11:12 PM, Jon Clayden wrote:
> I would also be interested in knowing what the rationale is for this.
>
> Moreover, it seems that the "standard" (and documented) approach to
> this of calling "options(defaultPackages=c(...))" in ~/.Rprofile does
> not get ignored when installing. The environment variable approach may
> work, but it seems to me that this requires some (educated) guesswork.
> Could R CMD INSTALL not ignore the default packages option?
>
> Regards,
> Jon
>
>
> On 16 February 2011 17:25, Brian G. Peterson<brian at braverock.com>  wrote:
>> On 02/16/2011 10:57 AM, Prof Brian Ripley wrote:
>>> The most obvious answer is not to do that. You have not used the
>>> standard mechanism to to do that (which should work here as R CMD
>>> INSTALL overrides that one). It's all in ?Startup (look for
>>> R_DEFAULT_PACKAGES).
>> Note that R CMD INSTALL is not mentioned at all here.
>>
>>> The simplest way to ignore ~/.Rprofile is to set R_PROFILE_USER to
>>> something else.
>>>> I've tried R --vanilla CMD INSTALL, but that seems to have no effect.
>>> As documented.
>> Then let's try this from another angle...
>>
>> Is there a rationale why --vanilla or --no-environ or --no-site-file or
>> --no-init-file are *NOT* supported by R CMD INSTALL ?  I don't see any
>> reasoning for the inconsistency in the docs anywhere.
>>
>> If not, would R-core entertain a patch that would handle these options?
>>
>> This functionality is troublesome in a production installations where we
>> *want* our users to have specific packages and environment options set all
>> the time, and I need to edit the Rprofile.site file every time I upgrade one
>> of these 'production' packages.
>>
>> Regards,
>>
>>    - Brian
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________________________________
The information in this email is confidential and intend...{{dropped:4}}



More information about the R-devel mailing list