Skip to content

Commit dbb7794

Browse files
committed
checking RHS of :=
1 parent 3a7ec2d commit dbb7794

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

R/data.table.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,9 @@ replace_dot_alias = function(e) {
316316
warningf("nomatch isn't relevant together with :=, ignoring nomatch")
317317
nomatch=NULL
318318
}
319+
if (length(jsub) >= 3L && is.function(jsub[[3L]])) {
320+
stopf("the right hand side of := should be a vector, list, data.frame, function or call, not a function,to store a function wrap it in a list: DT[, newcol := list(myfun)]")
321+
}
319322
}
320323
}
321324

0 commit comments

Comments
 (0)