this_file {optigrab} | R Documentation |
Name or path to the current file
this_file(opts = commandArgs(), local = TRUE, full.path = TRUE)
opts |
character; vector of arguments. (Default: |
local |
logical; if |
full.path |
logical; Whetther to return the full path to the sourced
file. (Default: |
this_file
returns the name or path of the executing file whehter
the file was invoked from Rscript or in an interactive session.
Further it source
Argument local
controls whether it is the current file (TRUE
)
or the orignal, top-level file.
one-element character vector with the path to the current file;
returns NA
is in an interactive session not in a file.
http://stackoverflow.com/questions/1815606/rscript-determine-path-of-the-executing-script
this_file()