this question has answer here:
- rscript: determine path of executing script 21 answers
- getting path of r script 8 answers
i file path of r script running. eg
when run function return
"c:/users/forename.surname/documents/foo.r"
(i running rstudio)
use getsrcdirectory() function. example, if put in file:
scriptpath <- function() { getsrcdirectory(scriptpath); } then calling scriptpath() tell script file located.
Comments
Post a Comment