How can I make a range of the ID of data while they are in sequence, for example: I have this
ID<-c(1,2,3,4,8,9,10,14,18,19,20,28,33,34,35,36,40,42,43,44,55,56)
I want it to count or make a range of the IDs that are in sequence series
my preferable output would be something like that
RANGE 1:4, 8:10, 14, 18:20, 28, 33:36, 40, 42:44, 55:56
NEW ID 1 2 3 4 5 6 7 8 9