title: Can Jupyter run a separate R notebook from within a Python notebook?
body: <p>I have a Jupyter notebook (python3) which is a batch job -- it runs three separate python3 notebooks using <code>%run</code>. I want to invoke a fourth Jupyter R-kernel notebook from my batch.</p>
  
  <p><strong>Is there a way to execute an external R notebook from a Python notebook in Jupyter / iPython?</strong></p>
  
  <p>Current setup:</p>
  
  <p><code>run_all.ipynb</code>: (python3 kernel)</p>
  
  <pre><code>%run '1_py3.ipynb'
  %run '2_py3.ipynb'
  %run '3_py3.ipynb'
  %run '4_R.ipynb'
  </code></pre>
  
  <p>The three python3 notebooks run correctly. The R notebook runs correctly when opened separately in Jupyter -- however it fails when called using <code>%run</code> from <code>run_all.ipynb</code>. It is interpreted as python, and the cell gives a python error on the first line:</p>
  
  <blockquote>
  <pre><code>cacheDir &lt;- "caches"
  </code></pre>
    
    <p>TypeError: bad operand type for unary -: 'str'</p>
  </blockquote>
  
  <p>I am interested in any solution for running a separate R notebook from a python notebook -- Jupyter magic, shell, python library, et cetera. I would also be interested in a workaround -- e.g. a method (like a shell script) that would run all four notebooks (both python3 and R) even if this can't be done from inside a python3 notebook. </p>
  
  <p>(NOTE: I already understand how to embed <code>%%R</code> in a cell. This is not what I am trying to do. I want to call a complete separate R notebook.)</p>