You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require(data.table) # CRAN stable at the moment, will update after testing from home on devel.dt<- data.table()
dt[, col:=NULL]
# Error in `[.data.table`(dt, , `:=`(col, NULL)) : # Cannot use := to add columns to a null data.table (no columns), currently. You can use := # to add (empty) columns to a 0-row data.table (1 or more empty columns), though.
I see this error mentioned in NEWS in 1.8.10! Didn't expect it to be that long ago. There's no issue number mentioned there.
Firstly I feel perhaps a warning would be sufficient instead of an error message?
And more importantly, removing a column on a null data.table could simply return the empty table without any error/warning, or for consistency, with a warning (assuming change to 'warning' goes through). Also the error/warning message should mention about 'removing' cols as well (minor).
The inconvenience with the way it is currently is that, when tables (/files) are being read off disk, and some tables don't exist, a null data.table is returned, and this error results in having an if() check everywhere before adding/removing cols by reference during downstream manipulations, which I find is unnecessary.
The text was updated successfully, but these errors were encountered:
I see this error mentioned in NEWS in 1.8.10! Didn't expect it to be that long ago. There's no issue number mentioned there.
Firstly I feel perhaps a warning would be sufficient instead of an error message?
And more importantly, removing a column on a null data.table could simply return the empty table without any error/warning, or for consistency, with a warning (assuming change to 'warning' goes through). Also the error/warning message should mention about 'removing' cols as well (minor).
The inconvenience with the way it is currently is that, when tables (/files) are being read off disk, and some tables don't exist, a null data.table is returned, and this error results in having an
if()
check everywhere before adding/removing cols by reference during downstream manipulations, which I find is unnecessary.The text was updated successfully, but these errors were encountered: