My R scratchpad

Set the current working directory to the source file's directory:

> this.dir <- dirname(parent.frame(2)$ofile)
> setwd(this.dir)

Source: Stackoverflow

Show Comments