[datatable-help] Error that I don't think should be an error

Chris Neff caneff at gmail.com
Thu Oct 27 18:43:17 CEST 2011


Pretty simple. I think assigning NULL to a column that doesn't exist
should just work as a no-op instead of failing with an error. No-op is
consistent with data.frame:

> dt=data.table(x=1:10)
> dt$y=NULL
Error in `[<-.data.table`(x, j = name, value = value) :
  RHS is NULL, meaning delete column(s). But, at least one column is
not present.
> dt[,y:=NULL]
Error in `[.data.table`(dt, , `:=`(y, NULL)) :
  RHS is NULL, meaning delete column(s). But, at least one column is
not present.
> df=data.frame(x=1:10)
> df$y=NULL

If agreed I will file a bug report.

-Chris


More information about the datatable-help mailing list