From Robert.McGehee at geodecapital.com  Fri May 29 20:45:39 2009
From: Robert.McGehee at geodecapital.com (McGehee, Robert)
Date: Fri, 29 May 2009 14:45:39 -0400
Subject: [Rd] install.packages now intentionally references .Rprofile?
References: <6ph4ovf1gi0.fsf@gopher4.fhcrc.org>	<alpine.LFD.2.00.0905210715100.30855@gannet.stats.ox.ac.uk><6b93d1830905211428h6f5d0e66hdebfb9a3c70984f8@mail.gmail.com>
	<4A167AAF.2040803@warwick.ac.uk>
Message-ID: <EEBC169715EB8C438D3C9283AF0F201C055EA984@MSGBOSCLM2WIN.DMN1.FMR.COM>

I see that related to this thread, 'R CMD INSTALL' (like
'install.packages') also reads the .Rprofile before beginning. This
caused package installation headaches for me that developers should be
aware (as it was very difficult to debug).

I added a setwd() to my .Rprofile [for example: setwd("/tmp")] to keep
.Rhistory files from popping up in directories throughout my computer.
This causes package installation to fail completely with an unhelpful
error message. For example (any package will do here):
> R CMD INSTALL zoo_1.5-6.tar.gz
Warning: invalid package 'zoo_1.5-6.tar.gz'
Error: ERROR: no packages specified

Removing 'setwd(...)' from the .Rprofile restores normal package
installation behavior.

I'd like to request that either setwd() not break installation, or the
user can disable .Rprofile reading on R CMD INSTALL (for instance with
an option such as --no-init-file). I'll use Heather's solution below for
the short-term, but would rather not have to completely turn off my
.Rprofile for non-interactive scripts.

Thanks, Robert


-----Original Message-----
From: r-devel-bounces at r-project.org
[mailto:r-devel-bounces at r-project.org] On Behalf Of Heather Turner
Sent: Friday, May 22, 2009 6:13 AM
To: Mark Kimpel
Cc: Prof Brian Ripley; r-devel at stat.math.ethz.ch
Subject: Re: [Rd] install.packages now intentionally references
.Rprofile?

I had a similar problem when moving to R-2.9.0 as my .Rprofile called
update.packages(). The solution was to use

if(interactive()) {
	utils:::update.packages(ask = FALSE)
}

HTH,

Heather

Mark Kimpel wrote:
> This was my original post, with the code example only slightly
modified by
> Martin for clarity. Prior to R-2.9.0, this repeated downloading did
not
> occur, the code worked as intended. In fact, if memory serves me
correctly,
> it even worked at least during the first 3 months of R-2.0.0 in its
> development stage, before release as a numbered version. Is there a
reason
> for that? Is there a work-around? As I mentioned in my original post,
the
> code is actually wrapped in a function that checks the date and the
date of
> the last update, and proceeds to update package once per week. It was
quite
> handy when it was working, hence my desire for a fix for my code.
> 
> Thanks,
> Mark
> ------------------------------------------------------------
> Mark W. Kimpel MD  ** Neuroinformatics ** Dept. of Psychiatry
> Indiana University School of Medicine
> 
> 15032 Hunter Court, Westfield, IN  46074
> 
> (317) 490-5129 Work, & Mobile & VoiceMail
> (317) 399-1219  Home
> Skype:  mkimpel
> 
> "The real problem is not whether machines think but whether men do."
-- B.
> F. Skinner
> ******************************************************************
> 
> 
> On Thu, May 21, 2009 at 2:17 AM, Prof Brian Ripley
<ripley at stats.ox.ac.uk>wrote:
> 
>> On Wed, 20 May 2009, Martin Morgan wrote:
>>
>>  A post on the Bioconductor mailing list
>>>  https://stat.ethz.ch/pipermail/bioconductor/2009-May/027700.html
>>>
>>> suggests that install.packages now references .Rprofile (?), whereas
>>> in R-2-8 it did not. Is this intentional?
>>>
>> Yes.  And in fact it did in earlier versions, to find the default
library
>> into which to install.
>>
>>
>>
>>> The example is, in .Rprofile
>>>
>>>  library(utils)
>>>  install.packages("Biobase",
>>>                  repos="http://bioconductor.org/packages/2.4/bioc")
>>>
>>> then starting R from the command line results in repeated downloads
>>> of Biobase
>>>
>>> mtmorgan at mm:~/tmp> R --quiet
>>> trying URL
>>> '
>>>
http://bioconductor.org/packages/2.4/bioc/src/contrib/Biobase_2.4.1.tar.
gz
>>> '
>>> Content type 'application/x-gzip' length 1973533 bytes (1.9 Mb)
>>> opened URL
>>> ==================================================
>>> downloaded 1.9 Mb
>>>
>>> trying URL
>>> '
>>>
http://bioconductor.org/packages/2.4/bioc/src/contrib/Biobase_2.4.1.tar.
gz
>>> '
>>> Content type 'application/x-gzip' length 1973533 bytes (1.9 Mb)
>>> opened URL
>>> ==================================================
>>> downloaded 1.9 Mb
>>>
>>> ^C
>>> Execution halted
>>>
>>>  sessionInfo()
>>> R version 2.9.0 Patched (2009-05-20 r48588)
>>> x86_64-unknown-linux-gnu
>>>
>>> locale:
>>>
>>>
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.U
TF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=
C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATI
ON=C
>>>
>>> attached base packages:
>>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>>
>>> Martin
>>> --
>>> Martin Morgan
>>> Computational Biology / Fred Hutchinson Cancer Research Center
>>> 1100 Fairview Ave. N.
>>> PO Box 19024 Seattle, WA 98109
>>>
>>> Location: Arnold Building M1 B861
>>> Phone: (206) 667-2793
>>>
>>> ______________________________________________
>>> R-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>
>>>
>> --
>> Brian D. Ripley,                  ripley at stats.ox.ac.uk
>> Professor of Applied Statistics,
http://www.stats.ox.ac.uk/~ripley/<http://www.stats.ox.ac.uk/%7Eripley/>
>> University of Oxford,             Tel:  +44 1865 272861 (self)
>> 1 South Parks Road,                     +44 1865 272866 (PA)
>> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>>
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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



[Rd] install.packages now intentionally references .Rprofile?
McGehee, Robert