[R] is there a way to update both packages if they occur in 2 libraries?

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Oct 20 14:40:58 CEST 2010


On Wed, 20 Oct 2010, Uwe Ligges wrote:

>
>
> On 20.10.2010 13:59, Chris Howden wrote:
>> Thanks Uwe,
>> 
>> It may operate like that on most peoples machines, but either its not
>> operating like that on mine. Or I have another problem :-(
>> 
>> As u can see from my code below I've run update.packages(checkBuilt=TRUE)
>> and my 'private' library is in my LibPaths()...
>> 
>> However when I try to load the foreign package I get an error message
>> telling me "package "foreign' was built before R 2.10.0:
>
>
> Ah, I haven't read your original message carefully enough: Package foreign is 
> a base package. Base packages should only be in the R base library, not in 
> any other library. They cannot be updated via update.packages().

Not quite (and it is a recommended not a base package).  They can be 
updated *if updates are available*.

update.packages(checkBuilt=TRUE) cannot update packages that are 
not currently on the selected repositories.  This includes

For Windows binaries, the recommended packages (which you have anyway 
in .Library) until later versions than those in 2.12.0 are available.

Any packages which have been withdrawn.

Any packages for which binaries are not available for R 2.12.x (and 
there are few, see
http://cran.r-project.org/bin/windows/contrib/2.12/ReadMe and those 
with ERROR on
http://cran.r-project.org/bin/windows/contrib/checkSummaryWin.html).

A useful check is to run

summary(packageStatus())

which reports packages which are unavailable in each library, directly 
via (for the jth library)

summary(packageStatus())$Libs[[j]]$unavailable

>
> Best wishes,
> Uwe
>
>
>> please re-install
>> it". But then if I remove my private library from the search path I can
>> load foreign....so this suggests the problem is with the foreign package
>> in my 'private library'.
>> 
>> Furthermore, if I look at the description file for foreign it claims to
>> have been built for R package 2.9.2. (I've copied it below).
>> 
>> I'm concluding the issue is with the foreign package in my private library
>> since it claims to have been built for R 2.9.2&  I can get the package to
>> load if I remove my private library from the library search path and laod
>> the foreaign package from the base library.
>> 	I'm then concluding the problem is due to it not updating since
>> the description file 	claims it was built for R version 2.9.2 and due to
>> the error message I'm getting ie 	"foreign' was built before R
>> 2.10.0: please re-install it"
>> 
>> 
>> BUT I'm happy to be proven wrong... I just can't think of what else the
>> problem could be?????
>> 
>> 
>> 
>> FOREIGN DESCRIPTION FILE
>> Package: foreign
>> Priority: recommended
>> Version: 0.8-39
>> Date: 2010-01-03
>> Title: Read Data Stored by Minitab, S, SAS, SPSS, Stata, Systat, dBase,
>>          ...
>> Depends: R (>= 2.6.0), stats
>> Imports: methods, utils
>> Maintainer: R-core<R-core at r-project.org>
>> Author: R-core members, Saikat DebRoy<saikat at stat.wisc.edu>, Roger
>>          Bivand<Roger.Bivand at nhh.no>  and others: see COPYRIGHTS file in
>>          the sources.
>> Description: Functions for reading and writing data stored by
>>          statistical packages such as Minitab, S, SAS, SPSS, Stata,
>>          Systat, ..., and for reading and writing .dbf (dBase) files.
>> LazyLoad: yes
>> License: GPL (>= 2)
>> BugReports: http://bugs.r-project.org
>> Packaged: 2010-01-03 10:24:13 UTC; ripley
>> Repository: CRAN
>> Date/Publication: 2010-01-03 14:06:04
>> Built: R 2.9.2; i386-pc-mingw32; 2010-01-03 23:21:40 UTC; windows
>> 
>> 
>> 
>> 
>> 
>> 
>> Chris Howden
>> Founding Partner
>> Tricky Solutions
>> Tricky Solutions 4 Tricky Problems
>> Evidence Based Strategic Development, IP development, Data Analysis,
>> Modelling, and Training
>> (mobile) 0410 689 945
>> (fax / office) (+618) 8952 7878
>> chris at trickysolutions.com.au
>> 
>> 
>> -----Original Message-----
>> From: Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de]
>> Sent: Wednesday, 20 October 2010 9:15 PM
>> To: Chris Howden
>> Cc: r-help
>> Subject: Re: [R] is there a way to update both packages if they occur in 2
>> libraries?
>> 
>> update.packages() updates all packages in all libraries listed in
>> .libPaths() unless you specify an explicit library.
>> 
>> It may happen that the version number has not changed and you just want
>> to reinstall for your upgraded R. In that case use:
>> 
>> update.packages(checkBuilt=TRUE)
>> 
>> Best,
>> Uwe Ligges
>> 
>> 
>> 
>> On 20.10.2010 04:07, Chris Howden wrote:
>>> Hi everyone,
>>> 
>>> 
>>> 
>>> I've recently added a private library as a way to manage my R libraries.
>> And
>>> I did this by simply copying my old library to a new folder and then
>> linking
>>> this to R by setting my R_LIBS  environmental variable in .Renviron.
>>> 
>>> 
>>> 
>>> However I have run into a problem.
>>> 
>>> 
>>> 
>>> When I update my packages it is not updating those that are current in
>> the
>>> base R library.
>>> 
>>> 
>>> 
>>> This means I can't load packages that are included in base R, since R is
>>> looking in my private library first and when it finds the package it
>> tries
>>> to use it. But it's an outdated version.
>>> 
>>> 
>>> 
>>> The easiest solution I can think of is to update both libraries, but
>> when I
>>> run update.packages(lib.loc="private library location" ask = FALSE,
>>> checkBuilt=TRUE) it's not updating them.
>>> 
>>> 
>>> 
>>> So I was wondering if there is a way to update all packages  that occur
>> in
>>> all libraries?
>>> 
>>> 
>>> 
>>> 
>>> 
>>> (Note that I can think of other solutions to my problem, but they are
>> all
>>> time consuming and defeats the purpose of why I want a private library
>> i.e.
>>> it makes updating R easier since I don't need to copy over the library
>>> folder each time nor update any environmental variables. So far the best
>>> alternative I've come up with is to delete all the duplicate base R
>>> libraries from my private library)
>>> 
>>> 
>>> 
>>> If anyone is interested the code I used to understand my problem is
>> below.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Thanks everyone
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>>> update.packages(lib.loc="C:\\Program Files\\R\\library", ask = FALSE,
>>> checkBuilt=TRUE)
>>> 
>>> --- Please select a CRAN mirror for use in this session ---
>>> 
>>> 
>>> 
>>>> update.packages(ask = FALSE, checkBuilt = TRUE)
>>> 
>>> 
>>> 
>>> Foreign package won't load
>>> 
>>>> library(foreign)
>>> 
>>> Error: package 'foreign' was built before R 2.10.0: please re-install it
>>> 
>>> 
>>> 
>>>> .libPaths()
>>> 
>>> [1] "C:\\Program Files\\R\\library"   "C:/PROGRA~1/R/R-212~1.0/library"
>>> 
>>> 
>>> 
>>>> .libPaths("new")
>>> 
>>> 
>>> 
>>>> .libPaths()
>>> 
>>> [1] "C:/PROGRA~1/R/R-212~1.0/library"
>>> 
>>> 
>>> 
>>> Foreign package will load
>>> 
>>>> library(foreign)
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Chris Howden
>>> 
>>> Founding Partner
>>> 
>>> Tricky Solutions
>>> 
>>> Tricky Solutions 4 Tricky Problems
>>> 
>>> Evidence Based Strategic Development, IP development, Data Analysis,
>>> Modelling, and Training
>>> 
>>> (mobile) 0410 689 945
>>> 
>>> (fax / office) (+618) 8952 7878
>>> 
>>> chris at trickysolutions.com.au
>>>
>>> 	[[alternative HTML version deleted]]
>>> 
>>> 
>>> 
>>> 
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>> 
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list