Add breakpoints to certain dates in a data set.
Arguments
- data
A
<data.frame>
of confirmed cases (confirm) by date (date).confirm
must be numeric anddate
must be in date format. Optionally this can also have a logicalaccumulate
column which indicates whether data should be added to the next data point. This is useful when modelling e.g. weekly incidence data. See also thefill_missing()
function which helps add theaccumulate
column with the desired properties when dealing with non-daily data. If any accumulation is done this happens after truncation as specified by thetruncation
argument.- dates
A vector of dates to use as breakpoints.
Examples
reported_cases <- add_breakpoints(example_confirmed, as.Date("2020-03-26"))