I have a vector of 1-60 values, that could only be one of three values
For example:
x <- c("VAL1","VAL1","VAL1","VAL2","VAL2","VAL3","VAL3","VAL3","VAL3","VAL1")
I would like to condense this vector by removing values base on the previous value, ie. remove n+1 if n = n+1, but if n != n+1 return n and n+1
The desired output would look like this:
x <- c("VAL1","VAL2","VAL3","VAL1")
I think am going to need to use a for loop, checking where i matches i+1, but I am having trouble with the syntax