Dear R users,

is there a hack how to get the filename of the current script.r sourced/ran?

My issue: I have a couple of scripts which were optimised and are placed in
tens of directories. (I have a height.r script in 30 directories, a lines.r
script in 25 directories and another flow.r script in 54 directories,
growing). The script runs in the directory and does its job: sources data
and creates plots. From time to time I realise there is a possible update to
a script and then I have to copy the new version over all my directories to
overwrite the old scripts. So, it is better to have a script height.r:

# height.r script beg
SourceFileDir <- "f:/documents/data & fits/THz Imaging Lab/r scripts"
SourceFileName <- "height.r"
source(file.path(SourceFileDir, SourceFileName))
# height.r script end

placed in every directory and when running it, it sources the one and only
script height.r (this is the core script file) from a fix place.

But, I need again three/more other scripts depending on the name (thus type)
of the script (note the third line of the script above). Anything which
would give me the name of the script currenlty running or last sourced or
anything.
 I know getwd() gives me the working dir, but I need the working script
name.

Any help appriciated. Thank you very much in advance.
Milan

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to