title: R: How to find non-sequential elements in an array
body: <p>I have an array with several numbers in it and I don't know beforehand what the numbers will be. I would like to separate out those numbers in the array which are not sequential to the previous number (in addition to the first number in the sequence).  </p>
  
  <p>For example:
  Array: <code>2 3 4 5 10 11 12 15 18 19 20 23 24</code></p>
  
  <p>I would like to return <code>2 10 15 18 23</code></p>
  
  <p>The original array could be of variable length, including length zero  </p>
  
  <p>Thanks  </p>