naniar
naniar copied to clipboard
shadow-shift / impute-below doesn't handle dates
shadow_shift and therefore impute_below
don't handle date objects:
dat_date <- data.frame(date = as.POSIXct(c(111,
112,
NA,
NA,
108,
150,
160),
origin = "1970-01-01"))
# as.numeric(dat_date$date)
naniar::shadow_shift(dat_date$date)
#> Error: shadow_shift does not know how to deal with data of class POSIXctPOSIXt please check your input is more than length one
Created on 2018-05-03 by the reprex package (v0.2.0).
This should be able to be fixed by doing some conversion to a numeric object, then sending it back as a whole integer.
One thing to keep in mind here is:
- How do we find out what the original date origin was?
- Just how many date types are there?
It seems reasonable to convert the date to numeric and then coerce back to a date
There are three extra methods now:
-
POSIXct
-
POSIXlt
-
Date