R: How to find unclassified elements in an array
I have an array with multiple numbers in it and I don't know in advance what the numbers will be. I would like to highlight those numbers in an array that are not sequential to the previous number (in addition to the first number in the sequence).
For example: Array: 2 3 4 5 10 11 12 15 18 19 20 23 24
I would like to return 2 10 15 18 23
The original array can be of variable length, including zero length
thank
+3
source to share
3 answers