Assume I have the following vector:
v1 <- c(1, 2, 3, 4, 5)
If I wanted to expand this vector so that there are 50 1 values, 50 2 values, etc., how would I do this? Please let me know if you need any clarification.
Assume I have the following vector:
v1 <- c(1, 2, 3, 4, 5)
If I wanted to expand this vector so that there are 50 1 values, 50 2 values, etc., how would I do this? Please let me know if you need any clarification.
Have a look at this:
v1 <- c(1, 2, 3, 4, 5)
rep(v1, 2)
# [1] 1 2 3 4 5 1 2 3 4 5
Or with each (after @Rui's comment):
rep(v1, each = 2)
# [1] 1 1 2 2 3 3 4 4 5 5