Keeping R libraries in sync between different computers using Dropbox
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
We have a few computers including laptops in our network which all use
R (r-project.org) for statistics. We use Dropbox to keep all our files
in sync and we are all on ubuntu.
The problem was that we wanted to keep our R installations in sync so
we don’t have different libraries and settings everywhere.
All you need to do is copy the Renviron file from /etc/R/Renviron into
your dropbox,
and then open it and find a line that starts R_LIBS_USER=
We changed ours to R_LIBS_USER=${R_LIBS_USER-‘~/Dropbox/path/to/2.10’}
and moved the existing library folders from /usr/lib/R to their
corresponding new home in Dropbox. So this line tells R to look there
for its libraries, which as they are in dropbox will stay in sync.
We can also put any other site-wide settings we want in that file.
But we still need R to find that config file at startup, so on every
computer you now do
sudo ln ~/Dropbox/path/to/Renviron /etc/R/Renviron -s -b
what this does is overwrite the old R settings file with a link back
to a new file which is in Dropbox. So it will use the dropbox settings
file when R starts up.
(R distinguishes between site-wide configuration and individual
configuration but that doesn’t concern us).
Hope this is of use to someone googling R and Dropbox.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.