A different workaround that avoids generating a file would be to set an environment variable in your script:
set infile=%1 and then access infile using Sys.getenv within R. Date: Mon, 21 Feb 2005 16:38:57 +0100 From: BXC (Bendix Carstensen) <[EMAIL PROTECTED]> To: <[email protected]> Subject: [R] What file did R read? When I run in BATCH mode I use a script (win2000): c:\stat\r\%R_VERS%\bin\Rcmd BATCH -q --no-restore --no-save %1 Now I want to be able to print the filename of the program, i.e. the value if the %1 argument, in the .Rout file. (Basically I want to write a piece of code in .First() which prints date and time and program run, so I need to get to the value of %1. Currently I let the operating system print the value of %1 to a file, and then read the contents of this file. Clumsy, it works, but tricky to port to another machine.) The commandArgs() does NOT capture the name of the input file. Is it impossible to recover this filename from within R? Bendix Carstensen ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
