I've a sequence that goes from 1 to 3 and I need to repeat each value n + 1 times with n = 2. The way that I'm doing it now is:
seq <- c(rep(1, each = n), rep(2, each = n+1), rep(3, each = n+ 2))
# [1] 1 1 2 2 2 3 3 3 3
Is there a more concise way of writing that?