[R] Running source() on a file in another directory

Gang Chen gangchen6 at gmail.com
Thu Oct 2 00:09:56 CEST 2008

Suppose I have a file prog.R stored in a directory under ~/dirname,
and ~/dirname is set in a shell script file (e.g. .cshrc) as one of
the accessible paths on terminal. On a different directory I could run
prog.R interactively by executing


It seems that source() does not search for all the paths set in the
shell script. So, is there a better and more elegant way to do this,
for example without explicitly typing the directory?


More information about the R-help mailing list