Skip to content

Commit 1c92bb1

Browse files
committed
updated message
1 parent 98c43be commit 1c92bb1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

R/data.table.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,9 @@ replace_dot_alias = function(e) {
311311
jsub = jsub[[2L]] # to allow {} wrapping of := e.g. [,{`:=`(...)},] [#376]
312312
root = root_name(jsub)
313313
} else if (length(jsub) > 2L && jsub[[2L]] %iscall% ":=") {
314-
#2142 -- j can be {} and have length 1
315-
stopf("You have wrapped `:=` with `{}` which is ok, but then `:=` must be the only thing inside `{}` and must be used only once. You have other statements inside the `{}`. Consider placing `{}` on the RHS of `:=` instead, e.g., DT[, someCol := { tmpVar <- ...; tmpVar*2 }].")
316-
}
314+
#2142 -- j can be {} and have length 1
315+
stopf("Invalid use of `:=` inside `{}`. `:=` must be the only expression inside `{}` when used in `j`. Instead of: DT[{tmp1 <- ...; tmp2 <- ...; someCol := tmp1 * tmp2}], Use: DT[, someCol := {tmp1 <- ...; tmp2 <- ...; tmp1 * tmp2}]")
316+
}
317317
}
318318
if (root=="eval" && !any(all.vars(jsub[[2L]]) %chin% names_x)) {
319319
# TODO: this && !any depends on data. Can we remove it?

0 commit comments

Comments
 (0)