title: How to insert expression into the body of a function in R
body: <p>I have a function <code>f &lt;- function(x){x}</code>. I want to insert the line <code>x &lt;- 2*x</code> into <code>f</code> such that it ends up as</p>
  
  <pre><code>function(x){
      x &lt;- 2*x
      x
  }
  </code></pre>
  
  <p>I understand that I should be using <code>body()</code>, but I have thus far only figured out how to replace the <em>entire</em> body, which is not practical for my true purposes.</p>