Question: Is there any easy way to replicate R packages between two machines?
2
gravatar for Parham
3.6 years ago by
Parham1.3k
Sweden
Parham1.3k wrote:

Hi,

I am wondering if there is any easy way to have same packages of an existing R on machine 1 on a newly installed R on machine 2? Or I have to go through them and install them one by one manually? 

Thanks in advance!

packages replicate R • 1.3k views
ADD COMMENTlink modified 3.6 years ago by David Quigley11k • written 3.6 years ago by Parham1.3k
1
gravatar for mikhail.shugay
3.6 years ago by
mikhail.shugay3.3k
Czech Republic, Brno, CEITEC
mikhail.shugay3.3k wrote:

Also not sure if it helps, but using

.libPaths()

will show the folders where R packages were installed, you can then copy those folders manually

ADD COMMENTlink modified 3.6 years ago • written 3.6 years ago by mikhail.shugay3.3k

That looks very straightforward. So they don't need to be installed? Just if the folders are available in that path the libraries can be loaded? 

ADD REPLYlink written 3.6 years ago by Parham1.3k

Hi! Yes, they should work if the lib path on the other computer points to the correct directory. I've used this in one of my recent tools:

the installer was just going through package names and invoking

install.packages(..., lib = /path/to/libs)

while all scripts had

.libPaths(/path/to/libs)

library(...)

and it worked fine

ADD REPLYlink written 3.6 years ago by mikhail.shugay3.3k

That's great, thanks a lot.

ADD REPLYlink written 3.6 years ago by Parham1.3k
0
gravatar for Charles Warden
3.6 years ago by
Charles Warden5.1k
Duarte, CA
Charles Warden5.1k wrote:

Not sure if it is worth the effort, but you could use something like Docker to share a specific environment between computers.

ADD COMMENTlink written 3.6 years ago by Charles Warden5.1k

Thanks but it seems that's too complicated for me. 

ADD REPLYlink written 3.6 years ago by Parham1.3k
0
gravatar for David Quigley
3.6 years ago by
David Quigley11k
San Francisco
David Quigley11k wrote:

You can write a short script to use the built-in installed.packages() function to enumerate the existing packages on machine A and then use install.packages() to install those packages on machine B, remembering your friend the dependencies flag. I often run into snags when I attempt to install a binary package from a repository, only to find that the binary in bioconductor (for example) will not run on my current version of R on my particular platform. I tend to install from source for this reason. Specifying or pulling down source code would also let you be sure that you are installing the same version of each package, as you may run into trouble if you have version 2.11 on machine A and verison 2.16 on machine B.

 

ADD COMMENTlink written 3.6 years ago by David Quigley11k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1457 users visited in the last hour