Collaborative R coding using Dropbox

[This article was first published on [R] Randomness » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I do like Dropbox. I’m a big fan of easy to use solutions to common problems. For me I work at two different sites and I do a significant amount of work at my desktop machine at home as well as on my laptop. Dropbox solved the problem of synchronising files between multiple machines. However Dropbox can go that bit further and take that nice synchronised file store and share it with someone else with a Dropbox account. Now file sharing is nothing new but Dropbox makes it dead easy. Added to that a basic version control system built into the software and you have the workings of a reasonably decent code hosting and development system. Now this isn’t going to be what you’d use to develop a big project with multiple collaborators – there are tools out there like SVN or github far better suited to that task. But when a friend and I found that we needed to share and develop some R code we figured that Dropbox would be perfect for the job.

Setting up shared folders on Dropbox is pretty straightforward but if you’ve never done it before there’s a guide here. The next problem we found was that we had to make sure the script could correctly reference the path to data files and other scripts. Fortunately if your Dropbox folder is located in the same place as the R home directory (is is for a default install on Windows and Mac machines – I haven’t tested this on a Linux box yet) then it should be straightforward process.

You can check your R home directory using (example for Windows XP)

 

Sys.getenv("R_USER")
[1] "C:/Documents and Settings/Kate/My Documents"

 

Your Dropbox folder should be in My Documents too. Then in your R script set your working directory or file locations as follows:

 

setwd(path.expand("~/Dropbox/SharedRScript"))

 

That way you can define the location of any other called scripts or data relative to your shared folder and they should work irrespective of which machine you are on.  So far Dropbox is working pretty well for our needs. It’s free (at least for 2Gb storage), synchronises quickly and is easy to use. You might run into problems if several people are working on a file at the same time – it will save multiple versions rather than try to merge the files.  However for us it’s a good and easy solution to collaborative coding.

 

To leave a comment for the author, please follow the link and comment on their blog: [R] Randomness » R.

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.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)