Repeat rows of a data.frame [duplicate]

df <- data.frame(a = 1:2, b = letters[1:2]) 
df[rep(seq_len(nrow(df)), each = 2), ]

Leave a Comment