title: How to read in parameters to R script from commandline when doing GNU parallel jobs on HPC
body: <p>I am very new to GNU parallel, and I have some very basic questions. I need to do a large parameter sweep, and I have 6 different parameters. Following the documentation provided by the HPC cluster I am using, my command for submitting GNU jobs is the following:</p>
  <p><code>parallel -j 2 --colsep '\t' R CMD BATCH Rscript.R --a {1} --b {2} --c {3} --d {4} --e {5} --f {6} :::: parameter.txt</code></p>
  <p>parameter.txt contains the tab separated values of the 6 parameters (a-f). Say <code>a=1, b=2, ..., f=6</code>. After googling, I imagined that the Rscript will read in the parameters by <code>commandArgs()</code>. But this appearantly does not work. Simply setting Rscript.R to be a single line:</p>
  <p><code>args&lt;-commandArgs(trailingOnly=TRUE)</code></p>
  <p>the results for <code>args</code> is <code>NULL</code>. What is the correct way of reading in the parameters into Rscript.R in this case? Thank you very much!</p>