title: Running R script through qsub
body: <p>I am trying to run an <code>R</code> script called <code>test.r</code> through <code>qsub</code>. My <code>R</code> script is as follows:</p>
  
  <pre><code>#!/usr/bin/Rscript
  x &lt;- 1
  write.csv(x,"test.csv")
  </code></pre>
  
  <p>If in Ubuntu terminal I type <code>R CMD BATCH test.r</code>, then the script behaves as planned; <code>test.csv</code> gets exported in the same directory.</p>
  
  <p>However if I create a <code>bash</code> script called <code>testbash.sh</code> and run it through the command <code>qsub testbash.sh</code>; it will run without errors but the output won't be there. </p>
  
  <pre><code>#!/usr/bin/bash
  R CMD BATCH test.r
  </code></pre>
  
  <p>How to fix this?</p>