Closed alex-silverman closed 1 week ago
I think this is just a known general issue where data.table doesn't handle lubridate intervals very well (and S4 in general) https://github.com/Rdatatable/data.table/issues/4315. The solution will have to come from the data.table side unfortunately.
I have the following code to join two data.tables, where one has an interval.
x <- data.table(id = c(1,2), interval = c(lubridate::interval(Sys.Date(), Sys.Date() + 1), NA))
y <- data.table(id = c(1,1,2))
z <- x[y, on = .(id)]
If I run![image](https://github.com/tidyverse/lubridate/assets/3285721/1a76ee3d-af53-499a-98f0-97aa4a94ba7f)
print(z)
, though, I get the following warning:The problem is that z$interval's data has expanded to the 3 rows, but the @start attribute remains at 2.
Perhaps a clue is that the 2nd row, where
id
== 1, the interval is NA--NA instead of the expected 5/15/2024 -- 5/16/2024, and the 3rd row, whereid
== 2, is 5/15/2024--NA, instead of the expected NA--NA. It seems like the merge isn't working correctly?