-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
Description
Submitted by: Matt Dowle; Assigned to: Nobody; R-Forge link
Since deleting 1 column is DT[,colname:=NULL], and deleting rows is the same as deleting all columns for those rows, and we wish to use hierarchical indexes to find the rows to delete by reference, we just need a LHS to indicate "all" columns, leading to :
DT[i,.:=NULL] # delete rows by reference
DT[,.:=NULL] # error("must specify i to delete rows. To delete all rows from a table use DT[TRUE,.:=NULL], or, DT=DT[0]. This is deliberately a little harder, to avoid accidents such as "delete from table" a coomon accident in SQL.")
We can also add an attribute "read only" or "protect" to a data.table, and if the user had protected the data.table in that way, .:= would not work on it.
jeffkeller87, adamryczkowski, petermeissner, andrewrech, ChristK and 71 more