In R i can write a sequence of 1 - 9 like 1:9 and it will output c(1,2,3,4,5,6,7,8,9).
I want to do the reverse. If i have a sequence of c(1,2,3,4,5,6,7,8,9) is there any way to get 1:9 as an output? Preferably in a dynamic way, so that for example c(1,2,3,4,6,7,8,9) becomes c(1:4, 6:9)?