r - How to create a vector of sequences based on a vector of lengths -


I am hoping to make a vector of different length scenes (1: n). I am hoping to use the other vector to specify the length of these scenes.

For example, for my length vector:

  length < - c 10,6,4,7)  

I want to return R:

  1,2,3,4,5,6, 7,8,9,10,1,2,3,4,5,6,1,2,3,4, etc.  

I think there might be a loop in some sort of order, but I can not seem to work for it, maybe this is something like this:

 < Code> outside & lt; - For NULL (I Length (length)) {Out [i] & lt; - 1: Length [i]}  

I end up with this error:

Warning message: outside [i] & lt; - 1: Length [i]: The length of the replacement is not an honor

Any help is greatly appreciated!

  sequence (length) [1] 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 1 2 3 4 1 2 3 4 5 6 7  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -