We can use rep
on itself
rep(v, v)
If we want to specify the argument, use times
rep(v, times = v)
The each
would not take anonymous function and it takes only a vector of length 1. According to ?rep
each - non-negative integer. Each element of x is repeated each times. Other inputs will be coerced to an integer or double vector and the first element taken. Treated as 1 if NA or invalid.