| fill_dates | R Documentation |
This function can be used in case a start and end date is known for dosing. This function fills down the dates so each date between start and end is placed on a separate row. Subsequently the dataset can be used to merge with available date information and impute missing dates.
fill_dates(data, start, end, tau = 1, repdat = 1)
data |
data frame for which the dates should be filled down |
start |
character identifying the start date (as date format) within the data frame |
end |
character identifying the end date (as date format) within the data frame |
tau |
integer with the tau in days (e.g. 2 for dosing every other day) |
repdat |
integer with repeats per day (e.g. 2 in case of twice daily dosing) |
a data frame with filled out dates
Richard Hooijmaijers
dfrm <- data.frame(ID=1:2,first=as.Date(c("2016-10-01","2016-12-01"), "%Y-%m-%d"),
last=as.Date(c("2016-10-03","2016-12-02"), "%Y-%m-%d"))
fill_dates(dfrm, "first", "last")
fill_dates(dfrm, "first", "last", 2, 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.