powered by
This is a convenient wrapper to dirname(scriptloc())
script_dir_get()
Returns either a single string with path to the file being executed, or NULL
writeLines("library(scriptloc); script_dir <- script_dir_get(); print(script_dir)", "dir-example.R") source("dir-example.R") file.remove("dir-example.R")
Run the code above in your browser using DataLab