With upgrading data.table to the latest version 1.16.0 I noticed that the code below no longer works and throws the error Error in is.call(bysub) && !(bysub[[1L]] %chin% c("list", "as.list", "{", : 'length = 3' in coercion to 'logical(1)'
which is this piece of code
|
} else if (is.call(bysub) && !(bysub[[1L]] %chin% c("list", "as.list", "{", ".", ":"))) { |
In older version of data.table e.g. 1.14.8 it all works find. Also, when I replace base::mget by mget it also seems to work. Could it be caused by specifying the package?
Minimal example
dat <- data.table::as.data.table(datasets::iris)
cat_vars <- c("Species")
dat[, .(V1 = .N), by = base::mget(cat_vars)]
# Error in is.call(bysub) && !(bysub[[1L]] %chin% c("list", "as.list", "{", :
# 'length = 3' in coercion to 'logical(1)'
Session info
R version 4.4.1 (2024-06-14)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3; LAPACK version 3.9.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_IE.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_IE.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_IE.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_IE.UTF-8 LC_IDENTIFICATION=C
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] data.table_1.16.99
loaded via a namespace (and not attached):
[1] compiler_4.4.1 cli_3.6.3 tools_4.4.1 jsonlite_1.8.8 rlang_1.1.4
With upgrading data.table to the latest version
1.16.0I noticed that the code below no longer works and throws the errorError in is.call(bysub) && !(bysub[[1L]] %chin% c("list", "as.list", "{", : 'length = 3' in coercion to 'logical(1)'which is this piece of code
data.table/R/data.table.R
Line 789 in 8cc2dd1
In older version of data.table e.g.
1.14.8it all works find. Also, when I replacebase::mgetbymgetit also seems to work. Could it be caused by specifying the package?Minimal example
Session info