library(data.table)
dt <- data.table(x = runif(100), y = sample(LETTERS[1:5], 100, TRUE))
dt[, .(avg=mean(x), ), by=y] ## dangling comma past mean()
yields
Error in dotN(this_jsub) :
argument "this_jsub" is missing, with no default
whereas 1.11.8 and 1.12.0 produced the somewhat clearer:
Error in list(.External(Cfastmean, x, FALSE), ) : argument 2 is empty
It would be helpful to make the message a little plainer. Took me longer than I care to admit
to realize I left a dangling comma to yield on empty 'operator'.
# Output of sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.10
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.3.3.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8
[8] LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] data.table_1.12.2
loaded via a namespace (and not attached):
[1] compiler_3.5.3
Quite a strange corner of R we've got here:
x = substitute(list(1, ))[[3L]]
x
Error: argument "x" is missing, with no default
I took a look and I think we should catch this much earlier. Filing PR soon.
"Took me longer than I care to admit to realize I left a dangling comma to yield on empty 'operator'."
Thanks for the hint! :)
Most helpful comment
"Took me longer than I care to admit to realize I left a dangling comma to yield on empty 'operator'."
Thanks for the hint! :)