Skip to content

Instantly share code, notes, and snippets.

@tengpeng
Created February 9, 2015 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tengpeng/28139ec2a7fcba65017a to your computer and use it in GitHub Desktop.
Save tengpeng/28139ec2a7fcba65017a to your computer and use it in GitHub Desktop.
R: generate a repeating sequence based on vector
rep(c(1:4), each = 10)
[1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4
http://stackoverflow.com/questions/3672527/r-generate-a-repeating-sequence-based-on-vector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment