Let\'s say I have the following vector
vec <- rep(1:20,sample(1:5, 20, replace = T)) table(vec)
1 2 3 4 5 6 7 8 9 10 11 1