I tried searching for the data.table
functions to trunc dates.
round.IDate
for the weeks (IDateTime.R#81
) seems inaccurate: first week of year have a 6 days instead 7 (fix: should be yday(x) - 1L)
> rle(unclass(round(as.IDate(0:21), "week")))
Run Length Encoding
lengths: int [1:4] 6 7 7 2