Skip to content

How to move existing packages?

4 messages · G. Sawitzki, David Winsemius, Simon Urbanek

#
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.

   g.
#
On Jul 1, 2014, at 1:50 PM, G. Sawitzki wrote:

            
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.
[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()))])
                          }
#
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 10:50 PM, G. Sawitzki <gs at statlab.uni-heidelberg.de> wrote:

            
Yes it does - that is what the post you quote refers to - the OS X GUI specifically supports installation of packages based on previous R versions in the Package Installer.

Cheers,
Simon