Created
November 6, 2015 04:45
-
-
Save mdlincoln/528a53939538b07ade86 to your computer and use it in GitHub Desktop.
dplyr-friendly verb: replicate the rows of a data_frame n times
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
row_rep <- function(df, n) { | |
df[rep(1:nrow(df), times = n),] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment