title: How to define more than one external object in R functions?
body: <p>I really don't know how R functions works! It doesn't work like matlab that we can return and also call many objects of our function? </p>
  
  <p>I'm writting a function inwhich I need to have more than one outcome, but it returns me just one. 
  I wonder how the R programmers can write such  functions. For example: sort</p>
  
  <pre><code>s&lt;-sort(c(10:3, 2:12), method = "shell", index.return = TRUE)
  s$x
  s$ix
  </code></pre>
  
  <p>As we see we can call two external objects(x: sorted vector , ix: index of the sorted vector) </p>
  
  <p>Also I can't understand when I want to see inside the written function in R. for example for a simple function like "mean" we have:</p>
  
  <pre><code>&gt; mean
  function (x, ...) 
  UseMethod("mean")
  &lt;bytecode: 0x0000000017c57d28&gt;
  &lt;environment: namespace:base&gt;
  </code></pre>
  
  <p>Thanks en advance</p>
  
  <p>Nafis</p>