Description Usage Arguments Value Examples
Ensure that all units of observation have all dates within the max and min of the date variable.
1 | fill_dates(df, grouping_vars, date_var)
|
df |
the data.frame to fill in |
grouping_vars |
a character vector with the variable names that define the grouping structure that will uniquely identify the relavant units of observation |
date_var |
the same data.frame with any required dates filled in for each unit. Variables without grouping_vars will be missing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | set.seed(123)
tmp <- tibble(County = sample(LETTERS[1:3], 15, replace = TRUE),
Date = sample(seq(as.Date("2020-07-01"), as.Date("2020-07-07"), by = 1),
15, replace = TRUE)) %>%
distinct(.) %>%
arrange(County, Date)
#Compare
tmp
#To
arrange(fill_dates(tmp, grouping_vars = "County", date_var = "Date"),
County, Date)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.