# R and Dropbox

When you woRk, you probably have a set of useful functions/packages you constantly use. For example, I often use the excellent quantmod package, and the nice multi.sapply function. You want your tools loaded when R session fires.

In order to automatically load your objects into the session you can:
1. Customize your startup using “.Rprofile”.
2. Make a “UsefulObj.r” file for each project and source it.

I do not use (1). Using (2) with the excellent Dropbox product cluttered my scripts like so:
# source("Location 1/Dropbox/UsefulObj.r") # source("Location 2/Dropbox/UsefulObj.r")
and would uncomment according to the computer I was working on. Two lines for every file, clearly not the best practice.

I recently noticed few posts with joint R and Dropbox subject matter.
Tal Galili: syncing-files-across-computers-using-dropbox
 Nchars = unlist(regexec("x",getwd())) + 1 # x for the last char in dropbo-x. file1 = paste(substr(getwd(),start = 1,stop=Nchars),"UsefulObj.r",sep = "") file2 = paste(substr(getwd(),start = 1,stop = Nchars),"UsefulObj.r",sep = "")
 
FilesToLoad = c(file1,file2) sapply(FilesToLoad,source,.GlobalEnv) # Source these files