complete_dates {incidence2} | R Documentation |
Complete dates for all group combinations
Description
This function ensures that an incidence object has the same range of dates
for each grouping. By default missing counts will be filled with 0L
.
Usage
complete_dates(x, expand = TRUE, fill = 0L, by = 1L, allow_POSIXct = FALSE)
Arguments
x |
|
expand |
Should a range of dates from the minimum to maximum value of the date index also be created. If |
fill |
The value to replace missing counts by. Defaults to |
by |
Ignored. |
allow_POSIXct |
Should this function work with POSIXct dates? Defaults to |
Value
An incidence2 object.
Examples
x <- data.frame(
dates = Sys.Date() + c(1,3,4),
groups = c("grp1","grp2", "grp1"),
counts = 1:3
)
i <- incidence(x, date_index = "dates", groups = "groups", counts = "counts")
complete_dates(i)
[Package incidence2 version 2.3.1 Index]