I have a script called foo.R that includes another script other.R, which is in the same directory:
foo.R
other.R
#!/usr/bin/env Rscript message(\
I like this approach:
this.file <- sys.frame(tail(grep('source',sys.calls()),n=1))$ofile this.dir <- dirname(this.file)