Created
April 13, 2018 13:32
-
-
Save jthomasmock/0e913316aa89dd1033e0caef646b0f88 to your computer and use it in GitHub Desktop.
Tidyr::fill example
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
# generate dataset with 1x year per every 12 months | |
df <- data.frame(Month = rep(1:12, 3), | |
Year = c(2000, rep(NA, 11), | |
2001, rep(NA, 11), | |
2002, rep(NA, 11))) | |
# view the funky dataset | |
df | |
# fill the dataset with missing year! | |
# and bask in the glory of the clean datset! | |
df %>% | |
fill(Year) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment