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

[consistency] DT[,0,with=FALSE] should return an empty data.table #1140

Closed
franknarf1 opened this issue May 6, 2015 · 1 comment
Closed
Assignees
Milestone

Comments

@franknarf1
Copy link
Contributor

It's currently inconsistent with data.frame subsetting:

DF <- data.frame(a=1:5); DT <- data.table(DF)
DF[,0]
# data frame with 0 columns and 5 rows
DT[,0,with=FALSE]
# Error in `[.data.table`(DT, , 0, with = FALSE) : j out of bounds

I don't think it's possible to have a data.table with "0 columns and 5 rows" (as for DF[,0]). Maybe it could return a Null data.table, as [.listof(DT,0) does...?

(Short thread on mailing list)

@franknarf1
Copy link
Contributor Author

Sorry, not sure how to add the consistency tag; and I'm not sure if this is a bug, a feature request or neither.

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

No branches or pull requests

2 participants