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

@MichaelChirico MichaelChirico commented May 6, 2017

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

@MichaelChirico MichaelChirico commented May 6, 2017

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...

@mattdowle mattdowle closed this in 6e33943 May 11, 2017
mattdowle added a commit that referenced this issue May 11, 2017
Closes #2142 -- j can be {} without error
@mattdowle mattdowle added this to the v1.10.6 milestone May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants