Güngör Budak's Blog

Bioinformatics, web programming, coding in general

How to Get Path to or Directory of Current Script in R

Use following code to get the path to or directory of current (running) script in R:

scr_dir <- dirname(sys.frame(1)$ofile)
scr_path <- paste(scr_dir, "script.R", sep="/")

Taken from SO