I want to create a sequence, repeating each element according to a vector.

I have this:

v <- c(4, 4, 4, 3, 3, 2)

And want to create this:

1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 5 5 5 6 6

TIA

  // s

R version 3.0.0 (2013-04-03)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

	[[alternative HTML version deleted]]

