Skip to content

Instantly share code, notes, and snippets.

@mdlincoln
Created November 6, 2015 04:45
Show Gist options
  • Save mdlincoln/528a53939538b07ade86 to your computer and use it in GitHub Desktop.
Save mdlincoln/528a53939538b07ade86 to your computer and use it in GitHub Desktop.
dplyr-friendly verb: replicate the rows of a data_frame n times
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