Last active
November 14, 2017 09:38
-
-
Save verajosemanuel/b9497e0b942866cd785a061f979ded43 to your computer and use it in GitHub Desktop.
Expanding aggregates in #R #df #wrangling
This file contains hidden or 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
df <- data.frame(x = c(2, 4, 1), y = c(9, 11, 6), n = c(3, 5, 1)) | |
rep(1:nrow(df), df$n) | |
df[rep(1:nrow(df), df$n), ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment