title: How to examine the code of a function in R that's object class sensitive
body: <p>I'm trying to write a function to do a particular job (in my case, analyse a data set for outliers) so the first things I want to do is look at how other people have done similar jobs.</p>
  
  <p>I can do this to load a particular package and examine the code of a function, but some functions seem to depend on what class of object you throw at it</p>
  
  <pre><code>&gt;library(outliers)
  &gt; fix(outlier)
  
  function (x, opposite = FALSE, logical = FALSE) 
  {
      if (is.matrix(x)) 
          apply(x, 2, outlier, opposite = opposite, logical = logical)
      else if (is.data.frame(x)) 
          sapply(x, outlier, opposite = opposite, logical = logical)
      else {
          if (xor(((max(x) - mean(x)) &lt; (mean(x) - min(x))), opposite)) {
              if (!logical) 
                  min(x)
              else x == min(x)
          }
          else {
              if (!logical) 
                  max(x)
              else x == max(x)
          }
      }
  }
  </code></pre>
  
  <p>How can you look at the code of something that changes depending on the object ?</p>
  
  <p>Edit:</p>
  
  <p>OK, Palm &lt;- face.  The function I used as an example just calls itself, but allt he code is there... I have seen other examples (but can't think of any offhand) where the function did do other things depending on the class of the object thrown at it, so the question stands, even though it's a bad example !</p>