I would like to get the file path of the R script that I am running. eg
when I run the function it will return
"C:/Users/Forename.Surname/Documents/foo.R"
(I am running Rstudio)
Use the getSrcDirectory()
function. For example, if you put this in a file:
scriptPath <- function() {
getSrcDirectory(scriptPath);
}
Then calling scriptPath()
from will tell you where the script file is located.