I need to create a sequence of a large number (> 10000) of sequences of different lengths. I only know the lengths of these sequences in vector form.
length_v <- c(2,3,4,4,2,6,11,75...................)
Each sequence starts with 1 and moves forward with step 1. And in the final sequence (combined), each sequence should appear one after another, they cannot be mixed up.
Below is a small demo:
I say 4 sequences of length 2, 3, 4, 6, respectively.
s1 <- seq(1, 2)
s2 <- seq(1, 3)
s3 <- seq(1, 4)
s4 <- seq(1, 6)
Final sequence will be
final <- c(s1,s2,s3,s4) **
I cannot do this s> 10,000 sequences, which would be very inefficient. Is there an easier way to do this?