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.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…