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

Share Tweet

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

Share Tweet


Please start a discussion down below or send me an email!