title: R command line passing a filename to script in arguments (Windows)
body: <p>I'm having a hard time passing a filename to my R script. The file is a csv file with the batch parameters for multiple runs of the script. I am trying to include it here so that the user does not need to edit the R script in order to specify the location of that file.</p>
  
  <p>My Windows command line syntax is:</p>
  
  <pre><code>R CMD BATCH --slave "--args fn=batch.csv" myscript.r output.txt
  </code></pre>
  
  <p>The closest I have gotten to retrieving this in my R script is by doing:</p>
  
  <pre><code>eval(parse(file=commandArgs()[8])))
  batch_args = read.table(fn, sep=",")
  </code></pre>
  
  <p>I have experimented with <code>commandArgs(trailingOnly=TRUE)</code> and <code>parse(text=commandArgs()[8])</code>, etc., with no luck. Most of the documentation that I have seen does not apply specifically to passing filenames. Can anyone think of a solution?</p>