Reputation: 24613
I have R installed on one linux computer where there are number of packages installed. Now I am setting up R on another linux computer. Installing R is easy from their repository but I will have to install many packages using
install.packages("pkgname")
which will involve repeat downloading as well. Is there any way I can copy all the installed packages from first computer to the second one? Thanks for your help.
Upvotes: 4
Views: 3208
Reputation: 368499
I would recommend against this approach. Some of those packages will have been installed from source which includes compile-time checks based on what is installed on "computer one" and that will not necessarily be true on the other computer.
You have two basic choices
r-cran-pkgname
for various packages). These will work but a) not all of CRAN exists that way and b) they may lag the current release.saveRDS(installed.packages(), file="/tmp/pkgs.rds")
on the first computer and pkgs <- readRDS("/tmp/pkgs.rds"); install.packages(rownames(pkgs))
on the second after transfering the file.Upvotes: 10