[R-SIG-Mac] How to move existing packages?

G. Sawitzki gs at statlab.uni-heidelberg.de
Wed Jul 2 11:13:24 CEST 2014


Currently for me, .libPaths() points to

"/Library/Frameworks/R.framework/Versions/3.1/Resources/library"

After the next update, it will point to some version 3.x

"/Library/Frameworks/R.framework/Versions/3.x/Resources/library"

The libraries I am using are still in 3.1. The new 3.x will only hold
the standard libraries. I want 3.x populated in what I had in 3.1.



Of course one way out is to append the previous version to the libPaths,
but this may lead to confusion.



(To make it more fun: on OS X, to be really Mac like, R could make use
of the link
	/Library/Frameworks/R.framework/R
which points to
	./Versions/Current/R
resp.
	/Library/Frameworks/R.framework/Libraries
which points to
	./Versions/Current/Resources/lib
)

  gs.


On 02.07.2014 08:39, David Winsemius wrote:
> 
> On Jul 1, 2014, at 1:50 PM, G. Sawitzki wrote:
> 
>> This is a late follow up to
>> <https://stat.ethz.ch/pipermail/r-sig-mac/2013-April/010045.html>
>>
>> Is there a useful implementation to move existing packages?
>>
>> This comes up if there is a new R release and you want your old
>> collection updated, but work on a system that does versioning (e.g. OS X).
>>
>> The message referred above suggests to use the GUI Package Installer,
>> but at least on OS X this functionality does not exist.
> 
>> On a command level, this might be implemeted as a variant of
>> update.packages() with an additional parameter old.lib.loc (or a changed
>> semantics for oldPkgs: get a list of packages from old.lib.loc, and
>> update these to lib.loc.
>>
>> The design problem is that R does not keep a memory of where a package
>> has been installed. So an iteration over a list of repositories might be
>> needed.
> 
> Not sure what the issue is, and I think your understanding of the library system may be inadequate. The example in that message was using the standard Frameworks location. If you needed to get a more expansive list of R libraries, then execute:
> 
>  .libPaths()
> 
> You could also point list.dirs() at an old ../../library/ or two to gather a list of folder names.
> 
>> all <- list.dirs("/Library/Frameworks/R.framework/Versions/3.1/Resources/library", recursive=FALSE, full.names=FALSE)
>> all[1:10]
>  [1] "A2R"        "abind"      "acepack"    "Acinonyx"   "actuar"     "ada"       
>  [7] "adabag"     "ade4"       "adegenet"   "adehabitat"
> 
> 
> It doesn't seem to be that difficult to iterate over the contents of that vector.
> 
> 
> for (loc in .libPaths() ) {
>    a=rownames(installed.packages(loc))
>    install.packages(a[!(a %in% rownames(installed.packages()))])
>                           }
> 
> 
> 

-- 
G. Sawitzki
StatLab Heidelberg
Im Neuenheimer Feld 294
D 69120 Heidelberg
Tel. (+49) 62 21 - 54 89 79   Fax (+49) 62 21 - 54 53 31
    <http://www.statlab.uni-heidelberg.de/users/gs/>
GPG Fingerprint: FEA4 3F2A 88B2 2629 6CE2 0429 CC3C E49E D159 99AE



More information about the R-SIG-Mac mailing list