I want to find the directory where my R code file is located. If I attempt to
source("dir/hh.R")
then I would need to know in advance the directory in which the script is located. I would like to automatically identify the directory of my script, so I can call it like this:
pathToMyScript <- findDirectoryOfMyScript("hh.R")
source(paste0(pathToMyScript, "/hh.r"))
What function can I used to find automatically the path of my R code? What would be findDirectoryOfMyScript
like?