title: Capturing print output into a vector
body: <p>I want to capture the output of a for loop into a vector so it can be plotted.  A simple example is as follows:</p>
  
  <pre><code>for(i in 3:5) {
      z &lt;- i + 1
      print(z)
  }
  [1] 4
  [1] 5
  [1] 6
  </code></pre>
  
  <p>How can I capture the output of 4,5,6 so it can be plotted?  </p>