title: What ways are there to edit a function in R?
body: <p>Let's say we have the following function:</p>
  
  <pre><code>foo &lt;- function(x)
  {
      line1 &lt;- x
      line2 &lt;- 0
      line3 &lt;- line1 + line2
      return(line3)
  }
  </code></pre>
  
  <p>And that we want to change the second line to be:</p>
  
  <pre><code>    line2 &lt;- 2
  </code></pre>
  
  <p>How would you do that?</p>
  
  <p>One way is to use</p>
  
  <pre><code>fix(foo)
  </code></pre>
  
  <p>And change the function.</p>
  
  <p>Another way is to just write the function again.</p>
  
  <p>Is there another way? (Remember, the task was to change just the second line)</p>
  
  <p>What I would like is for some way to represent the function as a vector of strings (well, characters), then change one of it's values, and then turn it into a function again.</p>