Skip to content

Commit 7f5a437

Browse files
Simplify error for !with + :=
1 parent d35148a commit 7f5a437

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

R/data.table.R

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -686,10 +686,7 @@ replace_dot_alias = function(e) {
686686
if (is.null(jsub)) return(NULL)
687687

688688
if (!with) {
689-
if (jsub %iscall% ":=") {
690-
# TODO(>=1.18.0): Simplify this error
691-
stopf("with=FALSE together with := was deprecated in v1.9.4 released Oct 2014; this has been warning since v1.15.0. Please wrap the LHS of := with parentheses; e.g., DT[,(myVar):=sum(b),by=a] to assign to column name(s) held in variable myVar. See ?':=' for other examples.")
692-
}
689+
if (jsub %iscall% ":=") stopf("`:=` is only supported under with=TRUE.")
693690
# missingby was already checked above before dealing with i
694691
if (jsub %iscall% c("!", "-") && length(jsub)==2L) { # length 2 to only match unary, #2109
695692
notj = TRUE

inst/tests/tests.Rraw

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4629,7 +4629,7 @@ test(1241, DT[order(x,-y)], # optimized to forder()
46294629

46304630
DT = data.table(a=1:3, b=4:6)
46314631
myCol = "a"
4632-
test(1242.1, DT[2,myCol:=6L,with=FALSE], error="with=FALSE together with := was deprecated in v1.9.4")
4632+
test(1242.1, DT[2,myCol:=6L,with=FALSE], error="`:=` is only supported under with=TRUE.")
46334633
test(1242.2, DT[2,(myCol):=7L], data.table(a=INT(1,7,3), b=4:6))
46344634

46354635
# consistency of output type of mult, #340
@@ -13926,7 +13926,7 @@ test(1967.42, x[3, rollends = rep(TRUE, 10L)], error = 'rollends must be length
1392613926
test(1967.43, x[ , ..], error = 'symbol .. is invalid')
1392713927
test(1967.44, x[NULL], data.table(NULL))
1392813928
test(1967.45, x[ , NULL], NULL)
13929-
test(1967.46, x[ , 'b' := 6:10, with=FALSE], error='with=FALSE together with :=')
13929+
test(1967.46, x[ , 'b' := 6:10, with=FALSE], error='`:=` is only supported under with=TRUE.')
1393013930
x[, b := 6:10]
1393113931
test(1967.47, x[ , -1L, with = FALSE], data.table(b = 6:10))
1393213932
test(1967.48, x[ , b, .SDcols = 'a'], 6:10,

0 commit comments

Comments
 (0)