So Example I have this vectors:
v <- c(3,3,3,3,3,1,1,1,1,1,1,
3,3,3,3,3,3,3,3,3,3,3,3,
3,3,3,2,2,2,2,2,2,2,3,3,
3,3,3,3,3,3,3,3,3,3,3)
And I like to Simplify the vectors as this expected outputs:
exp_output <- c(3,1,3,2,3)
Whats the best and convenient way to do this? Thankyou