[R] How to get the current script file name in the script?

Peng Yu pengyu.ut at gmail.com
Tue Sep 22 17:47:55 CEST 2009


Hi,

Right now, I hardcode the file name in the script. But when I change
the script name, I have to change the file name in the script to make
sure the file name inside the script is synchronized with the script
name. I am wondering if there is an automatic way to get the script
file name in a script.

Regards,
Peng

$ Rscript get_file_name.R
> print('get_file_name.R')
[1] "get_file_name.R"
>




More information about the R-help mailing list