Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data.table merge doesn't work with intervals #1165

Open
alex-silverman opened this issue May 15, 2024 · 0 comments
Open

data.table merge doesn't work with intervals #1165

alex-silverman opened this issue May 15, 2024 · 0 comments

Comments

@alex-silverman
Copy link

alex-silverman commented May 15, 2024

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 print(z), though, I get the following warning:
image

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, where id == 2, is 5/15/2024--NA, instead of the expected NA--NA. It seems like the merge isn't working correctly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant