title: How to view value of a variable inside a function?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4442518/general-suggestions-for-debugging-r">General suggestions for debugging R?</a>  </p>
  </blockquote>
  
  
  
  <p>When debugging, I would often like to know the value of a variable used in a function that has completed executing. How can that be achieved?</p>
  
  <p>Example:</p>
  
  <p>I have function:</p>
  
  <pre><code>MyFunction &lt;- function() {
      x &lt;- rnorm(10) # assign 10 random normal numbers to x
      return(mean(x))
  }
  </code></pre>
  
  <p>I would like to know the values stored in <strong>x</strong> which are not available to me after the function is done executing and the function's environment is cleaned up.</p>