fix_date_continuity: Add NA rows to datestream datasets

Description Usage Arguments Value

Description

For a dataset that should contain at least one observation for each day (or second, minute, hour, etc), add NA rows for the missing observations

Usage

1
fix_date_continuity(dat, index, form = ymd, granularity = "days")

Arguments

dat

data frame with a date column that should contain a continuous stream of dates

index

index of column in dat containing dates

form

a lubridate parsing function in the ymd family, specifying the format the dates in dat are expected to be in. Default ymd.

granularity

what are the datestream units? Choose one of 'secs', 'mins', 'hours', 'days', 'weeks', 'years'. Default 'days'.

Value

a data frame, sorted by the dates in dat[,index], with the missing observations added. Dates in dat[,index] will be formatted as POSIXct, due to conversion with lubridate.


ropensci/testdat documentation built on May 27, 2019, 7:32 p.m.