Why is the complete
function shifting index
by 1 hour?
library(xts)
library(tidyr)
x = seq.Date(from = as.Date('2012-03-10'), to = as.Date('2012-03-25'), by = 'week')
x = xts::xts(1:length(x), order.by = as.POSIXct(paste0(x, ' 00:00:00')))
x = dat.tale::as.data.table(x)
x %>%
tidyr::complete(index = seq(min(index), max(index), 'day')) %>%
data.frame()
This gives an NA
value for 2012-03-17
that should have a value of 2 because the index column as been shifted by one hour. For other months this type of logic works fine. Running this for July, for example, gives the expected result.
How can I edit this so the date shift does not happen?