getting source file name
Hi, I have not tried to get a call when source'ing a file, but you get current function call from inside of the function using sys.call(). When I want to get the name of the variable which is the first argument of a function (e.g. for a plot title), I use varname <- unlist(strsplit(as.character(sys.call()), "[(,)]")[2]) Perhaps you find a solution, playing around a bit. Best wishes, Ott
On Tue, 13 Aug 2002 lutz.thieme at amd.com wrote:
|Hello everybody,
|
|is there a way to get the file name of the source file from which I read and
|execute my R code?
|In other words: If I'm executing "source('myRfile.r')" I'd like to have a statement
|inside myRfile.r like "src.file<-$0" (in unix csh style) which assigns th variable
|src.file to 'myRfile.r' .
|
|Thanks in advance!
|
|Best regards,
|
|Lutz
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._