title: What does the diff() function in R do?
body: <p>I do not understand what the function <code>diff()</code> in R does. See this example: </p>
  
  <pre><code> temp = c(10,1,1,1,1,1,1,2,1,1,1,1,1,1,1,3,10)
   diff(temp)
  </code></pre>
  
  <p>The above code produces the following output:</p>
  
  <pre><code> [1] -9  0  0  0  0  0  1 -1  0  0  0  0  0  0  2  7
  </code></pre>
  
  <p>What is the definition of this function?</p>