title: How to view the contents of parsed R functions?
body: <p>R is <a href="http://en.wikipedia.org/wiki/Functional_programming" rel="nofollow noreferrer">a functional programming language</a>, and one of it's primary benefits is it's ability to create open and transparent functions.</p>
  
  <p>As John Chambers says <a href="http://books.google.com/books?id=UXneuOIvhEAC&amp;printsec=frontcover" rel="nofollow noreferrer">in his excellent book "Software for Data Analysis: Programming with R"</a>:</p>
  
  <blockquote>
    <p>Computations are organized around functions, which can encapsulate specific, meaningful computational results, with implementations that can be examined for correctness.</p>
  </blockquote>
  
  <p>Notions such as "reproducible research" and "trustworthy software" are at the heart of R development.  In general, it is easy to examine a function just by typing its name without parenthesis.  For instance:</p>
  
  <pre><code>&gt; which
  function (x, arr.ind = FALSE) 
  {
      if (!is.logical(x)) 
          stop("argument to 'which' is not logical")
      wh &lt;- seq_along(x)[x &amp; !is.na(x)]
      dl &lt;- dim(x)
  ...
  </code></pre>
  
  <p>My question is: how do you example the contents of functions such as <code>for()</code> or <code>if()</code> without downloading the R source code?</p>
  
  <p><i>Edit:</i> Incidentally, I understand that this won't help viewing compiled code (such as C, C++, or Java) that may be called from R.  I'm really wondering if there is an R function which output's R functions.</p>