Skip to content

Commit 5786d1f

Browse files
committed
add second setalloccol check
1 parent 9bdd586 commit 5786d1f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

R/data.table.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,14 @@ replace_dot_alias = function(e) {
14401440
} else if (is.numeric(lhs)) {
14411441
lhs = names_x[m]
14421442
}
1443+
# cater for deleting columns by assigning NULL
1444+
if ((is.null(jval) || (is.list(jval) && any(vapply_1b(jval, is.null)))) && selfrefok(x, verbose=FALSE) < 1L) {
1445+
name = substitute(x)
1446+
setalloccol(x, verbose=FALSE)
1447+
if (is.name(name)) {
1448+
assign(as.character(name), x, parent.frame(), inherits=TRUE)
1449+
}
1450+
}
14431451
# TODO?: use set() here now that it can add new columns. Then remove newnames and alloc logic above.
14441452
.Call(Cassign,x,irows,cols,newnames,jval)
14451453
return(suppPrint(x))

0 commit comments

Comments
 (0)