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

strange error with non-empty empty j #2142

Closed
MichaelChirico opened this issue May 6, 2017 · 1 comment
Closed

strange error with non-empty empty j #2142

MichaelChirico opened this issue May 6, 2017 · 1 comment
Milestone

Comments

@MichaelChirico
Copy link
Member

This is pretty minor, but worth noting/documenting/fixing if it's easy. I came across it when commenting out parts of my code to test the output of a join absent performing the j operation:

library(data.table)
DT = data.table(a = 1:5)
DT[ , {}]

Error in jsub[[2L]] : subscript out of bounds

Closest operation in base R I guess is:

with(DT, {})
# NULL

I guess I would expect this to just return DT since that's what DT[ , ] does.

@MichaelChirico
Copy link
Member Author

Just at a glance, the problem is j is not missing (as in DT[ , ]), but length(jsub) == 1L. Around here [.data.table runs a few tests that look at jsub[[2L]]. So we could just put an escape when length(jsub) == 1L...

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

2 participants