Using dropbox with R

I like to use dropbox for online storage and syncing of R code and data that I am using at home and at work. Storing the code in the cloud means I always have access wherever I am, and that I don’t have to remember to bring my USB flashdrive to and from work.

My work computer (Windows XP) and my home computer (Ubuntu Linux) store their dropbox folders in different locations, meaning that calls to the R function setwd() will work on one of my computers, but not the other.

This chunk of R code checks which operating system R is being run under, and sets the working directory appropriately. I’m sure there are more elegant ways to fix this problem, but this approach works for me.

if(Sys.info()[1]=="Linux") {setwd("/home/michael/Dropbox")} else
                           {setwd("D:/Dropbox/My Dropbox")}
About these ads

One thought on “Using dropbox with R

  1. Pingback: R and Dropbox

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s