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

[R-Forge #5357] don't die when lhs of := has zero length #343

Closed
arunsrinivasan opened this issue Jun 8, 2014 · 0 comments
Closed

[R-Forge #5357] don't die when lhs of := has zero length #343

arunsrinivasan opened this issue Jun 8, 2014 · 0 comments
Assignees
Milestone

Comments

@arunsrinivasan
Copy link
Member

Submitted by: Eduard Antonyan; Assigned to: Arun ; R-Forge link

I frequently remove many columns by doing the following:

d = data.table(a = 1:5, b1 = 1:5, b2 = 1:5)
d[, grep("b", names(d)) := NULL]

Unfortunately the above dies when the search fails and the LHS is actually empty (integer(0) or character(0)):

d[, grep("c", names(d)) := NULL]
# Error in `[.data.table`(d, , `:=`(grep("c", names(d)), NULL)) : 
#   Logical error in assign, no column positions passed to assign

I'd much rather this resulted in no action + a warning.

@arunsrinivasan arunsrinivasan added this to the v1.9.4 milestone Jun 19, 2014
@arunsrinivasan arunsrinivasan self-assigned this Jun 20, 2014
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

1 participant