title: Difference between neighbouring elements of a vector
body: <p>I have no idea how to solve an introductory exercise to R, so the exercise is</p>
  <blockquote>
  <p>Create a vector z with all 99 differences between the neighbouring elements
  of x such that z[1]=x[2]-x[1], z[2]=x[3]-x[2], . . .</p>
  </blockquote>
  <p>I guess it is supposed to work without loops.</p>