title: ESS & Knitr/Sweave: How to source the Rnw file into an interactive session?
body: <p>This is a terribly simple request, and I can't believe I haven't found the solution to this yet, but I've been searching for it far and wide without luck.</p>
  
  <p>I have an <code>.Rnw</code> file loaded up in Emacs, I use <code>M-n s</code> to compile it.
  Everything works well, and it even opens an <code>R</code> buffer. Great. But that buffer
  is entirely useless: it doesn't contain the objects that I just sourced!</p>
  
  <p>Example minimal <code>.Rnw</code> file:</p>
  
  <pre><code>\documentclass{article}
  \begin{document}
  &lt;&lt;&gt;&gt;=
    foo &lt;- "bar"
  @
  \end{document}
  </code></pre>
  
  <p>Using <code>M-n s</code>, I now have a new R-buffer with a session loaded up, but:</p>
  
  <pre><code>&gt; foo
  Error: object 'foo' not found 
  </code></pre>
  
  <p>That is disappointing. I would like to play around with the data interactively.
  How do I achieve that? I don't want to be sourcing the file line-by-line, or
  region-by-region with <code>C-c C-c</code> or something similar every time I change my code.
  Ideally, it should be just like RStudio's source function, that leaves me with
  a fully prepared R session.</p>
  
  <p>I haven't tried this with sweave yet, only with knitr.</p>
  
  <p>EDIT: the <code>eval=TRUE</code> chunk option does not seem to result in the correct behaviour.</p>