More than one value for “each” argument in “rep” function?

Depending on what you think the output should be, I’m guessing you want the times= parameter:

rep (a, times = c(2, 4, 7))
# [1] 2 2 4 4 4 4 6 6 6 6 6 6 6

See ?rep for the difference

Leave a Comment