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

set could allow empty input without warning #4086

Closed
jangorecki opened this issue Dec 3, 2019 · 2 comments · Fixed by #4339
Closed

set could allow empty input without warning #4086

jangorecki opened this issue Dec 3, 2019 · 2 comments · Fixed by #4339
Assignees
Milestone

Comments

@jangorecki
Copy link
Member

d = data.table(a=1, b=1)
dropcols = character()
set(d, NULL, dropcols, NULL)
#Warning message:
#In set(d, NULL, dropcols, NULL) :
#  length(LHS)==0; no columns to delete or assign RHS to.

I don't think we really need a warning here, it could work without the need for if (length(dropcols)) set(...).

@jangorecki jangorecki self-assigned this Dec 3, 2019
@jangorecki
Copy link
Member Author

jangorecki commented Dec 3, 2019

data.table/src/assign.c

Lines 346 to 347 in 6f17d18

if (!length(cols)) {
warning("length(LHS)==0; no columns to delete or assign RHS to."); // test 1295 covers

That would unfortunately also remove the warning from d[, character() := NULL]. Are we OK to remove the warning from there also? IMO make sense

@jangorecki jangorecki removed their assignment Dec 3, 2019
@MichaelChirico
Copy link
Member

Agree don't need to warn, verbose message would be fine

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

Successfully merging a pull request may close this issue.

3 participants