If I’m following all this correctly, it seems your criticism is that R doesn’t 
provide a run-time function that is equivalent to a compile-time macro. You do 
realize that __FILE__ is not part of the C programming language - it’s a 
predefined variable recognized by the cpp - the C preprocessor program. 
Similarly, SAS_EXECFILENAME is a predefined variable that can be recognized by 
the SAS macro processor, but has no meaning in the SAS language itself.

So, to go back to your original post:
> 1.  Either create a variable "ScriptPath" in the first lines of each of my R 
> scripts and run a batch (or shell, etc.) to replace every single occurrence 
> of "ScriptPath <-" by "ScriptPath <- [Absolute path of the R script]" in all 
> the R scripts located in the folder (and possibly subfolders) of the batch 
> file.


This is what a macro processor does. Are you asking for a macro language in R?

Cheers

> On Oct 10, 2018, at 6:11 PM, Olivier GIVAUDAN <olivier_givau...@hotmail.com> 
> wrote:
> 
> It is not wrong to claim that R currently doesn't have a function returning 
> the path of the R file where this same function was invoked.
> 
> 'getwd()' is indeed not equivalent to VBA 'Application.ThisWorkbook.Path' or 
> C macro '__FILE__' or SAS %sysget(SAS_EXECFILENAME), etc.


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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