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!
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!
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
Not sure if it is worth the effort, but you could use something like Docker to share a specific environment between computers.
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.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
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?
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 fineThat's great, thanks a lot.