Recommended practice for installing projects and packages on different computer

Is there a best /swiftest practice for installing R projects and utilized R packages that exist on one computer to another?

This seems like the sort of thing Github does well. You can push and pull repos as you work on projects across different local machines.

1 Like

packrat will help you do that on a project level allowing easy deployment on the project on a new Environnement.

Shortly, it will infer the package dependency of the Project and generate a lock file describing what your project need. It will also put the package version sources in the project and then install them in a project library from this sources.
packrat::snapshot helps maintain the locked file up to date, packrat::restore helps with restauring everything from the locked file easily.

As everything your project need is in the project folder, packrat::bundle allows you to make a compressed bundle of your project (code + package sources). You can take this bundle on another computer then use packat::unbundle and restore.

Pretty easy to use with default behavior. You can customize it but it requires more work.

I can be used with github to transfer project without making a bundle. The packrat.lock file is the most important.

On a system level, I find pkgsnap useful and easier. It helps you snapshot you current packages environnement on your system in a text file. Then you can restore this snapshot from the text file on another computer easily to install the exact same version of package.
Sometimes you just need to recreate a work environment and it is enough.

This two solutions helps me transfer project or deploy project on new Environnement.

5 Likes

@cderv @kearneymw

Thanks for suggestions. I really should use packrat more often

However, I also play around with a lot of packages - not necessarily in a project and have hundreds in total installed
Is there any problem with just copying them from one win-library/3.4 to the other?

1 Like

On windows I think it should work without issue if you use them with the same Rversion .

I did this once successfully.