date_fill | R Documentation |
Given a dataframe with one column as a date sequence, fill gaps in the date sequence.
date_fill(data, date_col, interval = NULL, fill_cols = NULL, add_ymd = FALSE)
data |
Dataframe |
date_col |
The column containing dates |
interval |
The interval in the date sequence. If |
fill_cols |
Columns to fill with the value in the column (should be columns where value is same in every row, such as an ID.) |
add_ymd |
logical. Should the date be split into year, month, and day columns and added to the output? |
Dataframe with filled in dates
## Not run:
foo <- data.frame(Date = seq(as.Date("2008-01-01"), as.Date("2008-12-01"), by = "month"),
val = round(rnorm(12, 5, 2), 1), label = rep("a", 12))
bar <- foo[-c(2,5,6,7,10),]
date_fill(bar, "Date", interval = "1 month", fill_cols = "label")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.