I have quick question regarding sequence and each:
vect1 <- c(4, 5, 10, 3, 1)
I want replicate with this vector as each such that first number is replicated 4, second 5, third 10, fourth 3, and fifth equal 1.
rep(1:5, each = vect1)
[1] 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5
Warning message:
In rep(1:5, each = vect1) : first element used of 'each' argument
rep(1:5, each = c(4, 5, 10, 3, 1))
[1] 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5
Warning message:
In rep(1:5, each = c(4, 5, 10, 3, 1)) :
first element used of 'each' argument
I know this is misuse of each.
If you have questions about how to work functions in R, try
where “function” is whatever function you want to know about. From
?repyou would have read: