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

internal error when specifying .SDcols #4231

Closed
jangorecki opened this issue Feb 4, 2020 · 2 comments · Fixed by #4470
Closed

internal error when specifying .SDcols #4231

jangorecki opened this issue Feb 4, 2020 · 2 comments · Fixed by #4470
Assignees
Milestone

Comments

@jangorecki
Copy link
Member

jangorecki commented Feb 4, 2020

There is an issue in scope in which .SDcols is evaluated.
AFAIU there is no need to evaluate it in x's scope, and that is likely caused an issue here.

data.table(V1=-1L, V2=-2L, V3=-3L)[,.SD,.SDcols=-V2:-V1]
#Error in `[.data.table`(data.table(V1 = -1L, V2 = -2L, V3 = -3L), , .SD,  : 
#  Internal error: xcolAns does not pass checks: 1121
as.data.table(as.list(1:2))[, .SD,.SDcols=(-1L)]
#Error in colnamesInt(x, cols, check_dups = FALSE) : 
#  argument specifying columns specify non existing column(s): cols[1]=-1
as.data.table(as.list(1:3))[, .SD,.SDcols=(-1L)]
#Error in `[.data.table`(as.data.table(as.list(1:3)), , .SD, .SDcols = (-1L)) : 
#  Internal error: xcolAns does not pass checks: 2211,2
@ColeMiller1
Copy link
Contributor

For the first one, I think we should make users do -(V2:V1) - we probably could have special error handling to be helpful.

For the second one, I assume that if abs(number) is less than nrow(DT), we should return setdiff(seq_len(nrow(DT)), abs(number)) Is that how you see it?

@jangorecki
Copy link
Member Author

I think you mean ncol rather than nrow, yes it make sense

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