I have an array of numbers and I'd like to find the index of a specific digit ONLY when it's occuring alone, NOT when it's occuring in a sequence of the same digit. For example:
a <- c(1,2,4,5,5,8,1,2,8,8,8,4,3)
I would like to find the index of the SINGLE 8 occuring at index 6, I'm not interested in any of the other digits, nor in the sequence of 8's occuring at index 9-11. Is there a clever way to do this in R?