3

i've been getting up to speed using R of late, and am wondering what the most efficient way is to clone an RStudio environment, especially the package installations, from one machine to another. i'd like to be able to switch from my desktop machine to my laptop, but i am adding packages very frequently to the desktop as i work and would like a simple way to make sure the same packages get installed on the laptop.

any help much appreciated

ps. not everything i'm installing is from CRAN...some are packages taken from github

dave adelson
  • 853
  • 9
  • 15

2 Answers2

2

You can just copy and paste the folders in the R libraries between machines. As long as it is the same operating system on both machines there should not be any problem. If you want it to be automatically synchronised then place the R libraries into something like dropbox so that adding or updating a package will automatically appear on either machine with the next sync.

JeremyS
  • 3,497
  • 1
  • 17
  • 19
  • This will only work on Unix. On windows the packages are locked while R is running so the synchonisation might not work properly – RockScience Apr 04 '14 at 04:28
  • Dropbox syncs as soon as you connect to the internet but the files are stored locally, so it would only be a problem if you try and load a package while it is still synchronising (I'm guessing). – JeremyS Apr 04 '14 at 05:50
  • Dropbox sync will fail if R is running with a package loaded. Try to open R, load a package and replace the package folder by another one. You'll see the error – RockScience Apr 04 '14 at 07:06
  • I was under the impression the OP would not be using both machines at the same time. – JeremyS Apr 04 '14 at 07:24
2

If you have more than a couple of machine to maintain with the same R configuration, I think you should consider setting up your own local R repository.

And I will just redirect you to another SO question here: Creating a local R package repository

You can also find the most useful information in the R manual.

Once this is done, you just have to update the local R repository and the packages will be updated on all machines, Windows or Unix

Community
  • 1
  • 1
RockScience
  • 17,932
  • 26
  • 89
  • 125