[R] Is there a way to source from a specific Git repository without hardcoding the location everywhere?

Hadley Wickham h.wickham at gmail.com
Thu Sep 27 09:29:32 CEST 2012


>> where myProject is a package containing all the scripts, written as
>> functions.
>
> Yes, the eventual fate of these functions is expected to be a package. I'd
> like the pushed/pulled code to be runable as is without an intermediate
> step of package creation or gsub()ing hardcoded paths.

You might want to look at load_code in devtools (which is designing
for code stored in packages, but may work for your situation),
otherwise use only relative paths inside your project, and then ensure
people source(, chdir = T) one function that loads everything else.

If your example, all you need to do is
source("path/to/projectStart.r", chdir = T).

Hadley

-- 
RStudio / Rice University
http://had.co.nz/




More information about the R-help mailing list